Package Exports
- base32lib
- base32lib/dist/base32.js
- base32lib/lib/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (base32lib) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Base 32 encoding/decoding for JavaScript
Base 32 is between hexadecimal notation and Base 64 encoding. It's intended to be a human-friendly -- you don't have to worry about punctuation, capitalization, or letters/numbers that are easy to confuse, making it easier to transmit in handwriting or over the phone.
Base 32 will work the same with upper- or lowercase, you can mistake a number for a similar-looking letter, and it will still decode to the same data.
Getting started
In your shell, install with npm:
npm install base32libIn your code:
const base32lib = require('base32lib')
// encodings available: crockford, rfc4648, z-32, geohash, 32hex
// The default one is RFC4648
const encoded = base32lib.encode('some data to encode 123', 'rfc4648') //onxw2zjamrqxiyjaorxsazlomnxwizjagezdg===
const encoded2 = base32lib.encode('Some data to encOde 123') //onxw2zjamrqxiyjaorxsazlomnxwizjagezdg===
console.log(encoded === encoded2) // true
const decoded = base32lib.decode(encoded) // some data to encode 123The main specifications of something called "Base 32" are present in this library: RFC4648, Crockford, z-32, geohash, 32hex - see Wikipedia for some of them.
Minispec
- When decoding, capital letters are converted to lowercase and the depending on the spec "ambiguous" letters mentioned might be converted to their numeric counterparts.
- Each character corresponds to 5 bits of input.
- Lexicographic order of strings is preserved through Base 32 encoding.
Formalia
Under MIT License.