Add a base85 codec #11

Open
opened 2016-01-17 12:36:12 -06:00 by jpetso · 2 comments
jpetso commented 2016-01-17 12:36:12 -06:00 (Migrated from github.com)

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.

cppcodec doesn't have a base85 codec yet, but should. The [z85 variant](http://rfc.zeromq.org/spec:32) 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 commented 2016-02-07 07:57:37 -06:00 (Migrated from github.com)

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.

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.
kaidokert commented 2017-10-25 10:29:33 -05:00 (Migrated from github.com)

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

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 in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-tplgy/cppcodec#11
No description provided.