[Top] [All Lists]

Re: [openpgp] "OpenPGP Simple"

2015-03-17 22:55:50
David Shaw <dshaw(_at_)jabberwocky(_dot_)com> writes:

What if the encoding was really simple - something like 4 bytes always, and
the leftmost bit would mean "partial".  So any packet 2^31 or less could be
encoded in one piece, but we could still do partial for those situations that
needed it.  We could have any number of partial lengths, but it would always
end with a non-partial final length.

That's kind of ugly because now you're stuffing metadata into the length
field.  A better approach is the one used in BER indefinite-length encodings,
you have a flag at the start saying "lengths are indefinite", then a series of
partial lengths followed by an end-of-contents value, tag 0 and length 0.  In
other words it's something like:

  |len|  data  |len|  data  |len|  data  |0|

So once you hit a partial length of zero you know you're done.


openpgp mailing list

<Prev in Thread] Current Thread [Next in Thread>