Git Product home page Git Product logo

base45's Introduction

base45

An Base45-encoder/decoder in pure Erlang.

Source code at https://github.com/ratopi/base45.

Implementing encoding as defined in RFC 9285 (https://datatracker.ietf.org/doc/rfc9285/).

Import to your project

Use it in your project via rebar dependency:

{deps, [base45]}.

or for a specific release:

{deps, [{base45, "2.0.0"]}.

Or if you like to fetch the source code from github:

{rebar, {git, "https://github.com/ratopi/base45.git", {tag, "2.0.0"}}}.

See https://hex.pm/packages/base45 for more info about the hex package.

Overview of current releases are on the hex-page or at https://github.com/ratopi/base45/releases.

Usage

Usage is just straight forward. Currently only binaries are supported.

Encoding:

base45:encode(<<1,2,3>>).

gives

<<"X5030">>

Decoding:

base45:decode(<<"X5030">>).

gives

<<1,2,3>>

Calling decode with an illegal input string (like <<"GGW">>, which leads to 65536), will throw an illegal_encoding exception in a tuple, containing the problematic part of the input:

{illegal_encoding, <<"GGW">>}

Calling decode with an illegal input string with illegal base45 characters (that are characters not in the base45 alphabet), will throw an illegal_character exception in a tuple, containing the problematic part of the input:

{illegal_character, <<"=">>}

Feedback and bugs

Feel free to give me any feedback you like via github: https://github.com/ratopi/base45/issues

Breaking changes

With version 2.0.0 the typo in error atom "illegale_encoding" was fixed, and is now "illegal_encoding" (w/o "e").

base45's People

Contributors

ratopi avatar

Watchers

 avatar  avatar

base45's Issues

Invalid strings could be handled better

The documentation says "Calling decode with an illegal input string (like <<"GGW">>, which leads to 65536), will throw an illegale_encoding exception" but it is not true for all invalid strings. For instance, <<"=">> will throw a function clause exception.

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.