Giter VIP home page Giter VIP logo

base32768's Introduction

Base32768

This is a binary-to-text encoder which converts every 15 bits of input to a pair of printable characters in range U+0025..U+00ff. In other words, it generates 16 bytes of ISO8859-1-encoded bytes for every 15 bytes of binary data.

It was invented as a way to transmit binary files through serial devices using a delimiter-based, human-readable protocol. The output of Base32768 is free of whitespace (space, no-break space, soft hyphen etc.) and control characters. A few punctuation characters like + and = are also left out to be used as delimiters.

Main features

  • High-efficiency: adds only 6.7% of overhead on average

  • Small code and memory requirements (no lookup tables are needed)

  • Uses only printable characters encodeable with ISO8859-1, meaning it's friendly for debugging and even text editors.

Usage

require 'base32768'

i = StringIO.new("\x17\x65\x23\x1c\x8c\xdc\xaa\xd9\xe5\xbd\x23\x91\xd7\x00\xa3")
o = StringIO.new
Base32768.encode(i, o)

File.open('out.txt', 'w+') { |f| f.write(o.string) }
=> 16
o.string.force_encoding('iso8859-1').encode('utf-8')
=> "õÙ¯w|ìf¸uЫ[ItR¾"

Contributing

This project is intended to be a set of reference implementations for the encoder, with a single file per language.

To contribute:

  • Fork the project

  • Checkout a new branch

  • Make a pull request

If you want to implement the encoder in a different language follow these rules:

  • Use a single file

  • Write some test-cases

  • Make the program callable from the command line:

    • With -e it encodes the standard input to standard output

    • With -d it decodes the standard input to standard output

    • Otherwise it runs the test-cases

License

MIT. See LICENSE.

base32768's People

Contributors

romuloceccon avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

kelvinens

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.