Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
@darkwolf/base32
Advanced tools
npm i --save @darkwolf/base32
// ECMAScript
import Base32 from '@darkwolf/base32'
// CommonJS
const Base32 = require('@darkwolf/base32')
// Number Encoding
const integer = Number.MAX_SAFE_INTEGER // => 9007199254740991
const encodedInt = Base32.encodeInt(integer) // => 'H7777777777'
const decodedInt = Base32.decodeInt(encodedInt) // => 9007199254740991
const negativeInteger = -integer // => -9007199254740991
const encodedNegativeInt = Base32.encodeInt(negativeInteger) // => '-H7777777777'
const decodedNegativeInt = Base32.decodeInt(encodedNegativeInt) // => -9007199254740991
// BigInt Encoding
const bigInt = BigInt(Number.MAX_VALUE) // => 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368n
const encodedBigInt = Base32.encodeBigInt(bigInt) // => 'P7777777776AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
const decodedBigInt = Base32.decodeBigInt(encodedBigInt) // => 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368n
const negativeBigInt = -bigInt // => -179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368n
const encodedNegativeBigInt = Base32.encodeBigInt(negativeBigInt) // => '-P7777777776AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
const decodedNegativeBigInt = Base32.decodeBigInt(encodedNegativeBigInt) // => -179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368n
// Text Encoding
const text = 'Ave, Darkwolf!'
const encodedText = Base32.encodeText(text) // => 'IF3GKLBAIRQXE23XN5WGMII='
const decodedText = Base32.decodeText(encodedText) // => 'Ave, Darkwolf!'
const emojis = '🐺🐺🐺'
const encodedEmojis = Base32.encodeText(emojis) // => '6CPZBOXQT6ILV4E7SC5A===='
const decodedEmojis = Base32.decodeText(encodedEmojis) // => '🐺🐺🐺'
// Buffer Encoding
const buffer = Uint8Array.of(0x00, 0x02, 0x04, 0x08, 0x0f, 0x1f, 0x3f, 0x7f, 0xff) // => <Uint8Array 00 02 04 08 0f 1f 3f 7f ff>
const encodedBuffer = Base32.encode(buffer) // => <Uint8Array 41 41 42 41 49 43 41 50 44 34 37 58 37 37 59>
const decodedBuffer = Base32.decode(encodedBuffer) // => <Uint8Array 00 02 04 08 0f 1f 3f 7f ff>
const encodedBufferToString = Base32.encodeToString(buffer) // => 'AABAICAPD47X77Y='
const decodedBufferFromString = Base32.decodeFromString(encodedBufferToString) // => <Uint8Array 00 02 04 08 0f 1f 3f 7f ff>
// Custom Alphabet
const base32 = new Base32('234567ABCDEFGHIJKLMNOPQRSTUVWXYZ')
const encInt = base32.encodeInt(integer) // => 'BZZZZZZZZZZ'
const decInt = base32.decodeInt(encInt) // => 9007199254740991
const encNegativeInt = base32.encodeInt(negativeInteger) // => '-BZZZZZZZZZZ'
const decNegativeInt = base32.decodeInt(encNegativeInt) // => -9007199254740991
const encBigInt = base32.encodeBigInt(bigInt) // 'JZZZZZZZZZY22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222'
const decBigInt = base32.decodeBigInt(encBigInt) // => 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368n
const encNegativeBigInt = base32.encodeBigInt(negativeBigInt) // => '-JZZZZZZZZZY22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222'
const decNegativeBigInt = base32.decodeBigInt(encNegativeBigInt) // => -179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368n
const encText = base32.encodeText(text) // => 'C7VAEF32CLKR6UVRHXQAGCC='
const decText = base32.decodeText(encText) // => 'Ave, Darkwolf!'
const encEmojis = base32.encodeText(emojis) // => 'Y4JT3IRKNYCFPW6ZM4X2===='
const decEmojis = base32.decodeText(encEmojis) // => '🐺🐺🐺'
const encBuffer = base32.encode(buffer) // => <Uint8Array 32 32 33 32 43 34 32 4a 35 57 5a 52 5a 5a 53>
const decBuffer = base32.decode(encBuffer) // => <Uint8Array 00 02 04 08 0f 1f 3f 7f ff>
const encBufferToString = base32.encodeToString(buffer) // => '2232C42J5WZRZZS='
const decBufferFromString = base32.decodeFromString(encBufferToString) // => <Uint8Array 00 02 04 08 0f 1f 3f 7f ff>
FAQs
Base32
The npm package @darkwolf/base32 receives a total of 0 weekly downloads. As such, @darkwolf/base32 popularity was classified as not popular.
We found that @darkwolf/base32 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.