Add a base85 codec #11
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
need more info
need verification for fix
not so hard
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-tplgy/cppcodec#11
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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.
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