Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a base85 codec #11

Open
jpetso opened this issue Jan 17, 2016 · 2 comments
Open

Add a base85 codec #11

jpetso opened this issue Jan 17, 2016 · 2 comments

Comments

@jpetso
Copy link
Collaborator

jpetso commented Jan 17, 2016

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.

@jpetso
Copy link
Collaborator Author

jpetso commented Feb 7, 2016

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.

@jpetso jpetso removed the help wanted label Feb 7, 2016
@kaidokert
Copy link

kaidokert commented Oct 25, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants