base256b 1.0.1

encoder and decoder for base256 Braille
Documentation
  • Coverage
  • 100%
    5 out of 5 items documented0 out of 4 items with examples
  • Size
  • Source code size: 9.22 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 270.5 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 2s Average build duration of successful builds.
  • all releases: 2s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • konkitoman/base256b
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • konkitoman

Base 256 Braille

Docs

A way for wasting more memory when encoding binary in characters, but is more aesthetically pleasing! The UTF-8 Braille block is perfect for Base 256, but is using 3 bytes per character, so this will use more memory. Compared to base16/hex encoding is using 150% more memory. But this is using half of the screen space compared to base16/hex encoding.

Motivation

I don't like the fact that base32, base64 needs to be padded. The base16/hex notation is using to much screen space. I like the fact that in this use case braille is actually a binary representation.

Example

This is how a 32 bytes array looks in multiples codecs.

codec data
json [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31]
base16 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f
base32 AAAQEAYEAUDAOCAJBIFQYDIOB4IBCEQTCQKRMFYYDENBWHA5DYPQ====
base64 AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8=
base85 009C61O)~M2nh-c3=Iws5D^j+6crX17#SKH9337X
base256b ⠀⠁⠂⠃⠄⠅⠆⠇⠈⠉⠊⠋⠌⠍⠎⠏⠐⠑⠒⠓⠔⠕⠖⠗⠘⠙⠚⠛⠜⠝⠞⠟

Reference implementation

def to_base256(data):
    out = ""
    for b in data:
        out += chr(b + 0x2800)
    return out

def from_base256(text):
    out = []
    for c in text:
        out.append(ord(c) - 0x2800)
    return out