Open jpetso opened 8 years ago
I've got the core of of Z85 implemented, however it's got a requirement that encoding fails if the input data isn't a multiple of the block size (4 binary bytes or 5 encoded characters).
I'll have to look into how to deal with this kind of error, especially since the raw pointer version of encode()
is noexcept. Maybe the noexcept declaration should depend on whether exact block sizes are required. Also tests and whatnot.
Here is another z85 impl, with test suite included artemkin/z85 Reference ZMQ impl is here : https://github.com/zeromq/rfc/blob/master/src/spec_32.c
I'd be happy to help out as time allows to put the tests together
Also there are good js, python and lua libs to test against, supporting all three variants of encodings ( Asii85, z85 and rfc1924 ). In fact, as of python3.4 , two of those are supported as standard, base64.a85encode and b85encode
cppcodec doesn't have a base85 codec yet, but should.
The z85 variant would fit the current framework quite well and should be possible to implement without changes to the existing classes, I think. There's an existing C implementation at https://github.com/judsonx/base85 (with the same MIT license that cppcodec is using) that's mainly focused on Ascii85 but also supports z85, so it might have some useful parts (block encoding/decoding) that we could adopt.
Ascii85 seems worthwhile too but has header/footer parts which need extra care, so I suggest to implement a "barebone" codec variant such as z85 first.
The base85 variant suggested in RFC 1924 would also work for that purpose, but seems less widespread.