browserify-sha3
Advanced tools
Comparing version 0.0.4 to 0.0.5
10
index.js
const Sha3 = require('js-sha3') | ||
const Buffer = require('safe-buffer').Buffer | ||
const hashLengths = [ 224, 256, 384, 512 ] | ||
const hashLengths = [224, 256, 384, 512] | ||
@@ -18,3 +18,3 @@ const hash = function (bitcount) { | ||
} else if (typeof i === 'string') { | ||
this.content.push(new Buffer(i)) | ||
this.content.push(Buffer.from(i)) | ||
} else { | ||
@@ -26,8 +26,8 @@ throw new Error('Unsupported argument to update') | ||
hash.prototype.digest = function (encoding) { | ||
hash.prototype.digest = function (encoding = 'binary') { | ||
const result = Sha3[this.bitcount](Buffer.concat(this.content)) | ||
if (encoding === 'hex') { | ||
return result | ||
} else if (encoding === 'binary' || encoding === undefined) { | ||
return new Buffer(result, 'hex').toString('binary') | ||
} else if (encoding === 'binary') { | ||
return Buffer.from(result, 'hex') | ||
} else { | ||
@@ -34,0 +34,0 @@ throw new Error('Unsupported encoding for digest: ' + encoding) |
{ | ||
"name": "browserify-sha3", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "node-sha3 compatability for browserify", | ||
"main": "index.js", | ||
"scripts": { | ||
"lint": "standard", | ||
"test": "node ./tests" | ||
@@ -11,3 +12,3 @@ }, | ||
"type": "git", | ||
"url": "git+https://github.com/wanderer/browserify-sha3.git" | ||
"url": "git+https://gitlab.com/mjbecze/browserify-sha3.git" | ||
}, | ||
@@ -21,13 +22,19 @@ "keywords": [ | ||
"bugs": { | ||
"url": "https://github.com/wanderer/browserify-sha3/issues" | ||
"url": "https://gitlab.com/mjbecze/browserify-sha3/issues" | ||
}, | ||
"homepage": "https://github.com/wanderer/browserify-sha3#readme", | ||
"homepage": "https://gitlab.com/mjbecze/browserify-sha3#readme", | ||
"devDependencies": { | ||
"sha3": "^1.1.0", | ||
"tape": "^4.0.1" | ||
"sha3": "^2.0.6", | ||
"tape": "^4.11.0", | ||
"standard": "^13.1.0" | ||
}, | ||
"dependencies": { | ||
"js-sha3": "^0.6.1", | ||
"safe-buffer": "^5.1.1" | ||
"js-sha3": "^0.8.0", | ||
"safe-buffer": "^5.2.0" | ||
}, | ||
"standard": { | ||
"ignore": [ | ||
"/benchmark/" | ||
] | ||
} | ||
} |
@@ -8,3 +8,3 @@ var SHA3 = require('sha3') | ||
t.plan(2) | ||
// Generate 512-bit digest. | ||
// Generate 512-bit digest. | ||
var d = new SHA3.SHA3Hash() | ||
@@ -19,7 +19,7 @@ d.update('foo') | ||
// Generate 224-bit digest. | ||
var d = new SHA3.SHA3Hash(224) | ||
d = new SHA3.SHA3Hash(224) | ||
d.update('foo') | ||
// Generate 224-bit digest. | ||
var bd = new BSHA3.SHA3Hash(224) | ||
bd = new BSHA3.SHA3Hash(224) | ||
bd.update('foo') | ||
@@ -47,3 +47,3 @@ t.equal(d.digest('hex'), bd.digest('hex')) | ||
var data = crypto.randomBytes(32) | ||
// Generate 512-bit digest. | ||
// Generate 512-bit digest. | ||
var d = new SHA3.SHA3Hash() | ||
@@ -50,0 +50,0 @@ d.update(data) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
710908
75
16891
1
1
3
2
3
+ Addedjs-sha3@0.8.0(transitive)
- Removedjs-sha3@0.6.1(transitive)
Updatedjs-sha3@^0.8.0
Updatedsafe-buffer@^5.2.0