Skip to content

Add a base85 codec #11

Open
Open

Description

@jpetso

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.

Activity

  1. jpetso commented on Feb 7, 2016

    @jpetso
    CollaboratorAuthor

    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.

  2. kaidokert commented on Oct 25, 2017

    @kaidokert

    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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions