Socket
Socket
Sign inDemoInstall

base-x

Package Overview
Dependencies
1
Maintainers
2
Versions
24
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.5 to 2.0.6

6

index.js

@@ -9,2 +9,4 @@ // base-x encoding

var Buffer = require('safe-buffer').Buffer
module.exports = function base (ALPHABET) {

@@ -51,3 +53,3 @@ var ALPHABET_MAP = {}

function decodeUnsafe (string) {
if (string.length === 0) return new Buffer(0)
if (string.length === 0) return Buffer.allocUnsafe(0)

@@ -76,3 +78,3 @@ var bytes = [0]

return new Buffer(bytes.reverse())
return Buffer.from(bytes.reverse())
}

@@ -79,0 +81,0 @@

{
"name": "base-x",
"version": "2.0.5",
"version": "2.0.6",
"description": "Fast base encoding / decoding of any given alphabet",

@@ -39,3 +39,9 @@ "keywords": [

"tape": "^4.5.1"
},
"engines": {
"node": ">=4.5.0"
},
"dependencies": {
"safe-buffer": "^5.0.1"
}
}

@@ -55,9 +55,9 @@ # base-x

This means the encoded string 000f (using a 0-f alphabet) will actually decode
to 4 bytes unlike a typical hex codec which uniformly packs 4 bits into each
This means the encoded string 000f (using a base16, 0-f alphabet) will actually decode
to 4 bytes unlike a canonical hex encoding which uniformly packs 4 bits into each
character.
While unusual, this does mean that no padding is required and it works for bases
like 43. If you need standard hex encoding or base64 encoding you probably don't
want this.
like 43. **If you need standard hex encoding, or base64 encoding, this module is NOT
appropriate.**

@@ -80,5 +80,2 @@ The algorithm used to convert the base of the number is roughly this:

## License
This library is free and open-source software released under the MIT license.
## LICENSE [MIT](LICENSE)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc