Comparing version 2.1.0 to 3.0.0
@@ -1,2 +0,1 @@ | ||
'use strict' | ||
module.exports = require('./lib/api')(require('bindings')('keccak')) | ||
module.exports = require('./lib/api')(require('node-gyp-build')(__dirname)) |
@@ -1,10 +0,5 @@ | ||
'use strict' | ||
try { | ||
module.exports = require('./bindings') | ||
} catch (err) { | ||
if (process.env.DEBUG) { | ||
console.error('Keccak bindings are not compiled. Pure JS implementation will be used.') | ||
} | ||
module.exports = require('./js') | ||
} |
@@ -1,2 +0,1 @@ | ||
'use strict' | ||
module.exports = require('./lib/api')(require('./lib/keccak')) |
@@ -1,2 +0,1 @@ | ||
'use strict' | ||
const createKeccak = require('./keccak') | ||
@@ -3,0 +2,0 @@ const createShake = require('./shake') |
@@ -1,9 +0,6 @@ | ||
'use strict' | ||
const Buffer = require('safe-buffer').Buffer | ||
const Transform = require('stream').Transform | ||
const inherits = require('inherits') | ||
const { Transform } = require('stream') | ||
module.exports = function (KeccakState) { | ||
function Keccak (rate, capacity, delimitedSuffix, hashBitLength, options) { | ||
Transform.call(this, options) | ||
module.exports = (KeccakState) => class Keccak extends Transform { | ||
constructor (rate, capacity, delimitedSuffix, hashBitLength, options) { | ||
super(options) | ||
@@ -21,5 +18,3 @@ this._rate = rate | ||
inherits(Keccak, Transform) | ||
Keccak.prototype._transform = function (chunk, encoding, callback) { | ||
_transform (chunk, encoding, callback) { | ||
let error = null | ||
@@ -35,3 +30,3 @@ try { | ||
Keccak.prototype._flush = function (callback) { | ||
_flush (callback) { | ||
let error = null | ||
@@ -47,3 +42,3 @@ try { | ||
Keccak.prototype.update = function (data, encoding) { | ||
update (data, encoding) { | ||
if (!Buffer.isBuffer(data) && typeof data !== 'string') throw new TypeError('Data must be a string or a buffer') | ||
@@ -58,3 +53,3 @@ if (this._finalized) throw new Error('Digest already called') | ||
Keccak.prototype.digest = function (encoding) { | ||
digest (encoding) { | ||
if (this._finalized) throw new Error('Digest already called') | ||
@@ -73,3 +68,3 @@ this._finalized = true | ||
// remove result from memory | ||
Keccak.prototype._resetState = function () { | ||
_resetState () { | ||
this._state.initialize(this._rate, this._capacity) | ||
@@ -80,3 +75,3 @@ return this | ||
// because sometimes we need hash right now and little later | ||
Keccak.prototype._clone = function () { | ||
_clone () { | ||
const clone = new Keccak(this._rate, this._capacity, this._delimitedSuffix, this._hashBitLength, this._options) | ||
@@ -88,4 +83,2 @@ this._state.copy(clone._state) | ||
} | ||
return Keccak | ||
} |
@@ -1,9 +0,6 @@ | ||
'use strict' | ||
const Buffer = require('safe-buffer').Buffer | ||
const Transform = require('stream').Transform | ||
const inherits = require('inherits') | ||
const { Transform } = require('stream') | ||
module.exports = function (KeccakState) { | ||
function Shake (rate, capacity, delimitedSuffix, options) { | ||
Transform.call(this, options) | ||
module.exports = (KeccakState) => class Shake extends Transform { | ||
constructor (rate, capacity, delimitedSuffix, options) { | ||
super(options) | ||
@@ -20,5 +17,3 @@ this._rate = rate | ||
inherits(Shake, Transform) | ||
Shake.prototype._transform = function (chunk, encoding, callback) { | ||
_transform (chunk, encoding, callback) { | ||
let error = null | ||
@@ -34,9 +29,9 @@ try { | ||
Shake.prototype._flush = function () {} | ||
_flush () {} | ||
Shake.prototype._read = function (size) { | ||
_read (size) { | ||
this.push(this.squeeze(size)) | ||
} | ||
Shake.prototype.update = function (data, encoding) { | ||
update (data, encoding) { | ||
if (!Buffer.isBuffer(data) && typeof data !== 'string') throw new TypeError('Data must be a string or a buffer') | ||
@@ -51,3 +46,3 @@ if (this._finalized) throw new Error('Squeeze already called') | ||
Shake.prototype.squeeze = function (dataByteLength, encoding) { | ||
squeeze (dataByteLength, encoding) { | ||
if (!this._finalized) { | ||
@@ -64,3 +59,3 @@ this._finalized = true | ||
Shake.prototype._resetState = function () { | ||
_resetState () { | ||
this._state.initialize(this._rate, this._capacity) | ||
@@ -70,3 +65,3 @@ return this | ||
Shake.prototype._clone = function () { | ||
_clone () { | ||
const clone = new Shake(this._rate, this._capacity, this._delimitedSuffix, this._options) | ||
@@ -78,4 +73,2 @@ this._state.copy(clone._state) | ||
} | ||
return Shake | ||
} |
@@ -1,2 +0,1 @@ | ||
'use strict' | ||
const P1600_RHO_OFFSETS = [0, 1, 62, 28, 27, 36, 44, 6, 55, 20, 3, 10, 43, 25, 39, 41, 45, 15, 21, 8, 18, 2, 61, 56, 14] | ||
@@ -3,0 +2,0 @@ const P1600_ROUND_CONSTANTS = [ |
@@ -1,2 +0,1 @@ | ||
'use strict' | ||
const P1600_ROUND_CONSTANTS = [1, 0, 32898, 0, 32906, 2147483648, 2147516416, 2147483648, 32907, 0, 2147483649, 0, 2147516545, 2147483648, 32777, 2147483648, 138, 0, 136, 0, 2147516425, 0, 2147483658, 0, 2147516555, 0, 139, 2147483648, 32905, 2147483648, 32771, 2147483648, 32770, 2147483648, 128, 2147483648, 32778, 0, 2147483658, 2147483648, 2147516545, 2147483648, 32896, 2147483648, 2147483649, 0, 2147516424, 2147483648] | ||
@@ -3,0 +2,0 @@ |
@@ -1,3 +0,1 @@ | ||
'use strict' | ||
const Buffer = require('safe-buffer').Buffer | ||
const keccakState = require('./keccak-state-unroll') | ||
@@ -51,3 +49,3 @@ | ||
const output = Buffer.alloc(length) | ||
for (var i = 0; i < length; ++i) { | ||
for (let i = 0; i < length; ++i) { | ||
output[i] = (this.state[~~(this.count / 4)] >>> (8 * (this.count % 4))) & 0xff | ||
@@ -54,0 +52,0 @@ this.count += 1 |
{ | ||
"name": "keccak", | ||
"version": "2.1.0", | ||
"version": "3.0.0", | ||
"description": "Keccak sponge function family", | ||
@@ -14,2 +14,6 @@ "keywords": [ | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/cryptocoinjs/keccak.git" | ||
}, | ||
"license": "MIT", | ||
@@ -19,44 +23,17 @@ "contributors": [ | ||
], | ||
"files": [ | ||
"lib", | ||
"src", | ||
"binding.gyp", | ||
"bindings.js", | ||
"index.js", | ||
"js.js" | ||
], | ||
"main": "./index.js", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/cryptocoinjs/keccak.git" | ||
"browser": { | ||
"./index.js": "./js.js" | ||
}, | ||
"scripts": { | ||
"coverage": "nyc tape test/index.js", | ||
"coverage-lcov": "npm run coverage && nyc report -r lcov", | ||
"install": "npm run rebuild || echo \"Keccak bindings compilation fail. Pure JS implementation will be used.\"", | ||
"lint": "standard", | ||
"rebuild": "node-gyp rebuild", | ||
"test": "npm run lint && npm run unit", | ||
"unit": "tape test/index.js" | ||
"install": "node-gyp-build || exit 0" | ||
}, | ||
"dependencies": { | ||
"bindings": "^1.5.0", | ||
"inherits": "^2.0.4", | ||
"nan": "^2.14.0", | ||
"safe-buffer": "^5.2.0" | ||
"node-addon-api": "^2.0.0", | ||
"node-gyp-build": "^4.2.0" | ||
}, | ||
"devDependencies": { | ||
"browserify": "^16.5.0", | ||
"nyc": "^14.1.1", | ||
"proxyquire": "^2.1.3", | ||
"standard": "^14.3.1", | ||
"tape": "^4.11.0" | ||
}, | ||
"engines": { | ||
"node": ">=5.12.0" | ||
"node": ">=10.0.0" | ||
}, | ||
"gypfile": true, | ||
"browser": { | ||
"./index.js": "./js.js" | ||
} | ||
} | ||
"gypfile": true | ||
} |
# keccak | ||
Version | Mac/Linux | Windows | ||
------- | --------- | ------- | ||
[![NPM Package](https://img.shields.io/npm/v/keccak.svg?style=flat-square)](https://www.npmjs.org/package/keccak) | [![Build Status](https://img.shields.io/travis/cryptocoinjs/keccak.svg?branch=master&style=flat-square)](https://travis-ci.org/cryptocoinjs/keccak) | [![AppVeyor](https://img.shields.io/appveyor/ci/fanatid/keccak.svg?branch=master&style=flat-square)](https://ci.appveyor.com/project/fanatid/keccak) | ||
[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard) | ||
This module provides native bindings to [Keccak sponge function family][1] from [Keccak Code Package][2]. In browser pure JavaScript implementation will be used. | ||
@@ -10,0 +4,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
Install scripts
Supply chain riskInstall scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
615657
2
0
39
0
0
505
65
+ Addednode-addon-api@^2.0.0
+ Addednode-gyp-build@^4.2.0
+ Addednode-addon-api@2.0.2(transitive)
+ Addednode-gyp-build@4.8.2(transitive)
- Removedbindings@^1.5.0
- Removedinherits@^2.0.4
- Removednan@^2.14.0
- Removedsafe-buffer@^5.2.0
- Removedbindings@1.5.0(transitive)
- Removedfile-uri-to-path@1.0.0(transitive)
- Removedinherits@2.0.4(transitive)
- Removednan@2.20.0(transitive)
- Removedsafe-buffer@5.2.1(transitive)