n0cte / basex2bigint

Base encoding / decoding of any given alphabet

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

basex2bigint

Alphabets

See below for a list of commonly recognized alphabets, and their respective base.

Base Alphabet
2 01
8 01234567
11 0123456789a
16 0123456789abcdef
32 0123456789ABCDEFGHJKMNPQRSTVWXYZ
32 ybndrfg8ejkmcpqxot1uwisza345h769 (z-base-32)
36 0123456789abcdefghijklmnopqrstuvwxyz
58 123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz
62 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
64 ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/
66 ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.!~

Example

Base58

const base58 = `123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz`;
const bs58 = require('basex2bigint')(base58);

const decoded = bs58.decode('5Kd3NBUAdUn')

console.log(decoded)
// => 1861530178134950899n

console.log(bs58.encode(decoded))
// => 5Kd3NBUAdUn

About

Base encoding / decoding of any given alphabet

License:MIT License


Languages

Language:JavaScript 100.0%