On Thu, Feb 20, 2014 at 4:08 PM, Alan Silverstein <[email protected]> wrote:
> Good point. Â I'm well-acquainted with base-64 encoding for example.
> Just never thought of "safe reversible encoding to a null-terminated
> string" as a practical solution for arbitrary key-to-value mappings...
> Didn't start seeing base-64 until some years later... Â Clever.

You don't need anything as complicated as utf8 for this. You can use
COBS (constant overhead byte stuffing) to remove NULLs, It is dead simple
and guarenteed to never grow the key by more than a single byte for every
254 bytes of key. This means you can statically allocate your key buffers
just a couple bytes or so larger than you would otherwise and still have room
independent of the data. This isn't even that hacky as this is what COBS is
designed for. I am not sure why the technique isn't more commonly used, it
is pretty ingenious IMHO.

http://en.wikipedia.org/wiki/Consistent_Overhead_Byte_Stuffing


    John

------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
_______________________________________________
Judy-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/judy-devel

Reply via email to