rusticata/der-parser

Make Oid zero-copy

Closed this issue · 1 comments

Hi,

when parsing oids the binary representation is converted to Vec<u64>.

I propose to keep the binary representation and provide api for the conversion to Vec<u64> (or an iterator implementation).

In my case I use oids basically only for comparison with other oids.

The downsides I see for my proposal are:

  • the hierachical structure is not as easily visible in this way
  • api break: Oid would get an lifetime parameter (users of der-parser already handle lifetimes a lot, so I don't think this is a big issue)

The advantages:

  • zero-copy, Oid becomes smaller. In particular cloning does not heap allocate which is useful if you use them in many places.
  • parsing is faster
  • edit: a u64 can be too small (?)

I also propose to add a proc macro for easy construction and a Hash implementation.

I can implement the proposed changes if you are interested.

Closing, merged in #18