Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@darkwolf/base32hex
Advanced tools
npm i --save @darkwolf/base32hex
// ECMAScript
import Base32Hex from '@darkwolf/base32hex'
// CommonJS
const Base32Hex = require('@darkwolf/base32hex')
// Number Encoding
const integer = Number.MAX_SAFE_INTEGER // => 9007199254740991
const encodedInt = Base32Hex.encodeInt(integer) // => '7VVVVVVVVVV'
const decodedInt = Base32Hex.decodeInt(encodedInt) // => 9007199254740991
const negativeInteger = -integer // => -9007199254740991
const encodedNegativeInt = Base32Hex.encodeInt(negativeInteger) // => '-7VVVVVVVVVV'
const decodedNegativeInt = Base32Hex.decodeInt(encodedNegativeInt) // => -9007199254740991
// BigInt Encoding
const bigInt = BigInt(Number.MAX_VALUE) // => 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368n
const encodedBigInt = Base32Hex.encodeBigInt(bigInt) // => 'FVVVVVVVVVU00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
const decodedBigInt = Base32Hex.decodeBigInt(encodedBigInt) // => 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368n
const negativeBigInt = -bigInt // => -179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368n
const encodedNegativeBigInt = Base32Hex.encodeBigInt(negativeBigInt) // => '-FVVVVVVVVVU00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
const decodedNegativeBigInt = Base32Hex.decodeBigInt(encodedNegativeBigInt) // => -179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368n
// Text Encoding
const text = 'Ave, Darkwolf!'
const encodedText = Base32Hex.encodeText(text) // => '85R6AB108HGN4QRNDTM6C88='
const decodedText = Base32Hex.decodeText(encodedText) // => 'Ave, Darkwolf!'
const emojis = '🐺🐺🐺'
const encodedEmojis = Base32Hex.encodeText(emojis) // => 'U2FP1ENGJU8BLS4VI2T0===='
const decodedEmojis = Base32Hex.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 = Base32Hex.encode(buffer) // => <Uint8Array 30 30 31 30 38 32 30 46 33 53 56 4e 56 56 4f>
const decodedBuffer = Base32Hex.decode(encodedBuffer) // => <Uint8Array 00 02 04 08 0f 1f 3f 7f ff>
const encodedBufferToString = Base32Hex.encodeToString(buffer) // => '0010820F3SVNVVO='
const decodedBufferFromString = Base32Hex.decodeFromString(encodedBufferToString) // => <Uint8Array 00 02 04 08 0f 1f 3f 7f ff>
// Custom Alphabet
const base32Hex = new Base32Hex('ABCDEFGHIJKLMNOPQRSTUV0123456789')
const encInt = base32Hex.encodeInt(integer) // => 'H9999999999'
const decInt = base32Hex.decodeInt(encInt) // => 9007199254740991
const encNegativeInt = base32Hex.encodeInt(negativeInteger) // => '-H9999999999'
const decNegativeInt = base32Hex.decodeInt(encNegativeInt) // => -9007199254740991
const encBigInt = base32Hex.encodeBigInt(bigInt) // 'P9999999998AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
const decBigInt = base32Hex.decodeBigInt(encBigInt) // => 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368n
const encNegativeBigInt = base32Hex.encodeBigInt(negativeBigInt) // => '-P9999999998AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
const decNegativeBigInt = base32Hex.decodeBigInt(encNegativeBigInt) // => -179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368n
const encText = base32Hex.encodeText(text) // => 'IF5GKLBAIRQ1E451N70GMII='
const decText = base32Hex.decodeText(encText) // => 'Ave, Darkwolf!'
const encEmojis = base32Hex.encodeText(emojis) // => '8CP3BO1QT8ILV6E9SC7A===='
const decEmojis = base32Hex.decodeText(encEmojis) // => '🐺🐺🐺'
const encBuffer = base32Hex.encode(buffer) // => <Uint8Array 41 41 42 41 49 43 41 50 44 36 39 31 39 39 32>
const decBuffer = base32Hex.decode(encBuffer) // => <Uint8Array 00 02 04 08 0f 1f 3f 7f ff>
const encBufferToString = base32Hex.encodeToString(buffer) // => 'AABAICAPD691992='
const decBufferFromString = base32Hex.decodeFromString(encBufferToString) // => <Uint8Array 00 02 04 08 0f 1f 3f 7f ff>
FAQs
Base32Hex
We found that @darkwolf/base32hex 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.