Base58
Install
npm i --save @darkwolf/base58
Usage
import Base58 from '@darkwolf/base58'
const Base58 = require('@darkwolf/base58')
const integer = Number.MAX_SAFE_INTEGER
const encodedInt = Base58.encodeInt(integer)
const decodedInt = Base58.decodeInt(encodedInt)
const negativeInteger = -integer
const encodedNegativeInt = Base58.encodeInt(negativeInteger)
const decodedNegativeInt = Base58.decodeInt(encodedNegativeInt)
const bigInt = BigInt(Number.MAX_VALUE)
const encodedBigInt = Base58.encodeBigInt(bigInt)
const decodedBigInt = Base58.decodeBigInt(encodedBigInt)
const negativeBigInt = -bigInt
const encodedNegativeBigInt = Base58.encodeBigInt(negativeBigInt)
const decodedNegativeBigInt = Base58.decodeBigInt(encodedNegativeBigInt)
const text = 'Ave, Darkwolf!'
const encodedText = Base58.encodeText(text)
const decodedText = Base58.decodeText(encodedText)
const emojis = '🐺🐺🐺'
const encodedEmojis = Base58.encodeText(emojis)
const decodedEmojis = Base58.decodeText(encodedEmojis)
const buffer = Uint8Array.of(0x00, 0x02, 0x04, 0x08, 0x0f, 0x1f, 0x3f, 0x7f, 0xff)
const encodedBuffer = Base58.encode(buffer)
const decodedBuffer = Base58.decode(encodedBuffer)
const encodedBufferToString = Base58.encodeToString(buffer)
const decodedBufferFromString = Base58.decodeFromString(encodedBufferToString)
const dw58 = new Base58('AveDarkwo1f23456789BCEFGHJKLMNPQRSTUVWXYZbcdghijmnpqstuxyz')
const encInt = dw58.encodeInt(integer)
const decInt = dw58.decodeInt(encInt)
const encNegativeInt = dw58.encodeInt(negativeInteger)
const decNegativeInt = dw58.decodeInt(encNegativeInt)
const encBigInt = dw58.encodeBigInt(bigInt)
const decBigInt = dw58.decodeBigInt(encBigInt)
const encNegativeBigInt = dw58.encodeBigInt(negativeBigInt)
const decNegativeBigInt = dw58.decodeBigInt(encNegativeBigInt)
const encText = dw58.encodeText(text)
const decText = dw58.decodeText(encText)
const encEmojis = dw58.encodeText(emojis)
const decEmojis = dw58.decodeText(encEmojis)
const encBuffer = dw58.encode(buffer)
const decBuffer = dw58.decode(encBuffer)
const encBufferToString = dw58.encodeToString(buffer)
const decBufferFromString = dw58.decodeFromString(encBufferToString)
Contact Me