Skip to content

sensedata/base32-crockford-browser

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Base 32 (crockford variant) encoding/decoding for JavaScript

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.

What about the n other base32 npm packages?

The purpose of this fork is: it's streamlined for the browser and it actually conforms to crockfords variant.

Getting started

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)

Minispec

  • 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.

License

Under MIT License.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%