Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/esl/base16
The last time I hexadecimify Erlang binaries...
https://github.com/esl/base16
base16 erlang hexadecimal hexadecimal-converter rfc-4648 rfc4648
Last synced: 3 months ago
JSON representation
The last time I hexadecimify Erlang binaries...
- Host: GitHub
- URL: https://github.com/esl/base16
- Owner: esl
- License: mit
- Created: 2020-08-24T09:07:46.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-02-24T19:34:46.000Z (almost 3 years ago)
- Last Synced: 2024-09-16T17:23:59.216Z (5 months ago)
- Topics: base16, erlang, hexadecimal, hexadecimal-converter, rfc-4648, rfc4648
- Language: Erlang
- Homepage: https://tools.ietf.org/html/rfc4648
- Size: 27.3 KB
- Stars: 4
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Base16 encoding and decoding
============================[![Actions Status](https://github.com/esl/base16/workflows/ci/badge.svg)](https://github.com/esl/base16/actions)
[![codecov](https://codecov.io/gh/esl/base16/branch/main/graph/badge.svg)](https://codecov.io/gh/esl/base16)
[![Hex](http://img.shields.io/hexpm/v/base16.svg)](https://hex.pm/packages/base16)## API
Both `encode/1` and `decode/1` functions are of `(binary()) -> binary()` type.
The usage looks like:
```erlang
B = crypto:rand_bytes(10).
H = base16:encode(B).
B = base16:decode(H).
```Please, note:
* `base16:encode/1` returns lower-case letters.
* `base16:decode/1` requires the argument to be a binary of odd-number size, and it parses both in upper-case or lower-case encoding.## Implementation
Code is implemented using lookup tables, which tremendously speeds-up the algorithm and consumes constant memory. It's the fastest you can get using pure Erlang code!
## NOTE
Note that, lookup tables also means that the code-size is bigger.
If you're running on embedded, where smaller code-sizes are the actual best, you might benefit from using the version 1.0.0, both available on github and hex.License
-------The library itself is licensed under the MIT License.
The tests, due to dependency on [PropEr], are licensed under the GPLv3 license.
[PropEr]:http://proper.softlab.ntua.gr/index.html