This is an implementation of base32 (crockford variant) encoding and decoding for node.js/browser, focused on the browser with 0 dependencies
It's based on base32-browser which is based on base32-js.
The purpose of this fork is: it's streamlined for the browser and it actually conforms to crockfords variant.
In your shell, install with npm:
npm install github:sensedata/base32-crockford-browser
In your code:
import base32 from "base32-crockford-browser"
// simple api
const encoded = base32.encode("some data to encode")
const decoded = base32.decode(encoded)
-
The encoding alphabet consists of the numerals 0-9 and the letters a-z, excluding a few letters that might look like numbers, which we simply interpret as follows:
- I -> 1
- L -> 1
- O -> 0
-
When decoding, capital letters are converted to lowercase and the "ambiguous" letters mentioned above converted to their numeric counterparts.
-
Each character corresponds to 5 bits of input.
-
Lexicographic order of strings is preserved through Base 32 encoding.
Under MIT License.