Git Product home page Git Product logo

java-base24's People

Contributors

ibudiallo avatar kuon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

java-base24's Issues

Variable length and padded variations of Kuon Base24 encoding

Currently the encoding only supports the input lengths in multiples of 4 bytes or 7 characters depending on operation.

During implementation it became evident that encoding can be extended to support inputs of any arbitrary length.

The tricky part is the fact that log2(24) = 4.585 bits, i.e. 4.585 bits per encoded symbol which is a fractional value.

Here is the implementation: https://github.com/gapotchenko/Gapotchenko.FX/blob/new/Source/Data/Encoding/Gapotchenko.FX.Data.Encoding.Base24/GenericKuonBase24.cs

I am not too proud of it cause it uses floating point operations to track the number of bits. But it works reliably enough to share the achievement with you.

Another missing part was the padding. It is not required when inputs are strict multiplies of 4, but it is a good preference to have it for fractional blocks of data to allow a seamless support for concatenated blocks. The '=' padding symbol is a traditional choice of BaseN encodings.

Here are some test vectors for padded variable-length Kuon Base24 encoding:

"", "",
"00", "Z======",
"01", "A======",
"FF", "H7=====",
"FF00", "B84Z===",
"0102", "ZHR====",
"010203", "ZBRP2==",
"009060", "ZCPBZ=="

I also ran a data fuzzer for all possible data combinations with perfect results.

Choosing 7 characters blocks is a neat trick as it gives a nearly perfect log2(24^7) = 32.095 bits per block which is roughly corresponds to 4 bytes. Having these pieces at hand, the proposed Base24 encoding is a good candidate for RFC.

The formal name of the encoding

The proposed implementation is a variation of Base24 encoding.

You refer to it as "Base24" but there is no standardized approach for such an encoding yet in contrast to something like Base64 which is defined by W3C RFCs.

This means that we should give it a specific name. Some obvious proposals that come into mind are:

  1. Kuon Base24
  2. Goi Base24
  3. your suggestion ?

What name you do you prefer?

I would also suggest to imprint that chosen name into spec.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.