Skip to content

Commit

Permalink
Update node-gyp for node v12
Browse files Browse the repository at this point in the history
commit 413b91c
Author: Kirill Fomichev <fanatid@ya.ru>
Date:   Sun Dec 1 08:12:42 2019 +0300

    Remove package-lock.json

commit 79e2901
Author: Kirill Fomichev <fanatid@ya.ru>
Date:   Sun Dec 1 08:06:23 2019 +0300

    Add debug and lock files from package managers to gitignore

commit 86af949
Author: Jascha <jascha@jaeh.at>
Date:   Sun Dec 1 02:06:19 2019 +0100

    use let and const everywhere

commit b919cd7
Author: Jascha <jascha@jaeh.at>
Date:   Sun Dec 1 01:52:10 2019 +0100

    add node 13 to travis

commit 2dfe826
Author: Jascha <jascha@jaeh.at>
Date:   Sun Dec 1 01:50:23 2019 +0100

    reduce needed node version to actual required version

commit b282e5f
Author: Jascha <jascha@jaeh.at>
Date:   Sun Dec 1 01:49:14 2019 +0100

    update dependencies

commit 07e5ccb
Author: Jascha <jascha@jaeh.at>
Date:   Sun Dec 1 01:43:39 2019 +0100

    add node 5 to travis

commit e69f84c
Author: Jascha <jascha@jaeh.at>
Date:   Sun Dec 1 01:13:00 2019 +0100

    npm audit fix

commit 1022afc
Author: Jascha <jascha@jaeh.at>
Date:   Tue Nov 12 07:39:41 2019 +0100

    remove unsupported node versions

commit 64dea3a
Author: Jascha <jascha@jaeh.at>
Date:   Tue Nov 12 07:27:22 2019 +0100

    use node 12 in appveyor and travis

commit fe7e879
Author: Jascha <jascha@jaeh.at>
Date:   Tue Nov 12 07:20:16 2019 +0100

    update files to pass standard

commit 1c1418d
Author: Jascha <jascha@jaeh.at>
Date:   Tue Nov 12 07:20:05 2019 +0100

    update deps and add package-lock.json
  • Loading branch information
fanatid committed Dec 1, 2019
1 parent bce5b58 commit f545a8d
Show file tree
Hide file tree
Showing 13 changed files with 190 additions and 184 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ build
node_modules

npm-debug.log
package-lock.json
yarn-error.log
yarn.lock
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ os:
- osx
language: node_js
node_js:
- "5"
- "6"
- "8"
- "10"
- "11"
- "12"
- "13"
addons:
apt:
sources:
Expand Down
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ build: off
skip_tags: true
environment:
matrix:
- nodejs_version: "4"
- nodejs_version: "5"
- nodejs_version: "6"
- nodejs_version: "7"
- nodejs_version: "8"
- nodejs_version: "10"
- nodejs_version: "12"
platform:
- x86
- x64
Expand Down
10 changes: 5 additions & 5 deletions lib/api/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
'use strict'
var createKeccak = require('./keccak')
var createShake = require('./shake')
const createKeccak = require('./keccak')
const createShake = require('./shake')

module.exports = function (KeccakState) {
var Keccak = createKeccak(KeccakState)
var Shake = createShake(KeccakState)
const Keccak = createKeccak(KeccakState)
const Shake = createShake(KeccakState)

return function (algorithm, options) {
var hash = typeof algorithm === 'string' ? algorithm.toLowerCase() : algorithm
const hash = typeof algorithm === 'string' ? algorithm.toLowerCase() : algorithm
switch (hash) {
case 'keccak224': return new Keccak(1152, 448, null, 224, options)
case 'keccak256': return new Keccak(1088, 512, null, 256, options)
Expand Down
14 changes: 7 additions & 7 deletions lib/api/keccak.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'
var Buffer = require('safe-buffer').Buffer
var Transform = require('stream').Transform
var inherits = require('inherits')
const Buffer = require('safe-buffer').Buffer
const Transform = require('stream').Transform
const inherits = require('inherits')

module.exports = function (KeccakState) {
function Keccak (rate, capacity, delimitedSuffix, hashBitLength, options) {
Expand All @@ -21,7 +21,7 @@ module.exports = function (KeccakState) {
inherits(Keccak, Transform)

Keccak.prototype._transform = function (chunk, encoding, callback) {
var error = null
let error = null
try {
this.update(chunk, encoding)
} catch (err) {
Expand All @@ -32,7 +32,7 @@ module.exports = function (KeccakState) {
}

Keccak.prototype._flush = function (callback) {
var error = null
let error = null
try {
this.push(this.digest())
} catch (err) {
Expand All @@ -57,7 +57,7 @@ module.exports = function (KeccakState) {
this._finalized = true

if (this._delimitedSuffix) this._state.absorbLastFewBits(this._delimitedSuffix)
var digest = this._state.squeeze(this._hashBitLength / 8)
let digest = this._state.squeeze(this._hashBitLength / 8)
if (encoding !== undefined) digest = digest.toString(encoding)

this._resetState()
Expand All @@ -73,7 +73,7 @@ module.exports = function (KeccakState) {

// because sometimes we need hash right now and little later
Keccak.prototype._clone = function () {
var clone = new Keccak(this._rate, this._capacity, this._delimitedSuffix, this._hashBitLength, this._options)
const clone = new Keccak(this._rate, this._capacity, this._delimitedSuffix, this._hashBitLength, this._options)
this._state.copy(clone._state)
clone._finalized = this._finalized

Expand Down
12 changes: 6 additions & 6 deletions lib/api/shake.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'
var Buffer = require('safe-buffer').Buffer
var Transform = require('stream').Transform
var inherits = require('inherits')
const Buffer = require('safe-buffer').Buffer
const Transform = require('stream').Transform
const inherits = require('inherits')

module.exports = function (KeccakState) {
function Shake (rate, capacity, delimitedSuffix, options) {
Expand All @@ -20,7 +20,7 @@ module.exports = function (KeccakState) {
inherits(Shake, Transform)

Shake.prototype._transform = function (chunk, encoding, callback) {
var error = null
let error = null
try {
this.update(chunk, encoding)
} catch (err) {
Expand Down Expand Up @@ -52,7 +52,7 @@ module.exports = function (KeccakState) {
this._state.absorbLastFewBits(this._delimitedSuffix)
}

var data = this._state.squeeze(dataByteLength)
let data = this._state.squeeze(dataByteLength)
if (encoding !== undefined) data = data.toString(encoding)

return data
Expand All @@ -64,7 +64,7 @@ module.exports = function (KeccakState) {
}

Shake.prototype._clone = function () {
var clone = new Shake(this._rate, this._capacity, this._delimitedSuffix, this._options)
const clone = new Shake(this._rate, this._capacity, this._delimitedSuffix, this._options)
this._state.copy(clone._state)
clone._finalized = this._finalized

Expand Down
58 changes: 29 additions & 29 deletions lib/keccak-state-reference.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'
var 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]
var P1600_ROUND_CONSTANTS = [
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]
const P1600_ROUND_CONSTANTS = [
0x00000001, 0x00000000,
0x00008082, 0x00000000,
0x0000808a, 0x80000000,
Expand Down Expand Up @@ -28,7 +28,7 @@ var P1600_ROUND_CONSTANTS = [
]

function p1600 (state) {
for (var round = 0; round < 24; ++round) {
for (let round = 0; round < 24; ++round) {
theta(state)
rho(state)
pi(state)
Expand All @@ -39,64 +39,64 @@ function p1600 (state) {

// steps
function theta (s) {
var clo = [0, 0, 0, 0, 0]
var chi = [0, 0, 0, 0, 0]
const clo = [0, 0, 0, 0, 0]
const chi = [0, 0, 0, 0, 0]

for (var x = 0; x < 5; ++x) {
for (var y = 0; y < 5; ++y) {
for (let x = 0; x < 5; ++x) {
for (let y = 0; y < 5; ++y) {
clo[x] ^= s[ilo(x, y)]
chi[x] ^= s[ihi(x, y)]
}
}

for (x = 0; x < 5; ++x) {
var next = (x + 1) % 5
var prev = (x + 4) % 5
var dlo = rol64lo(clo[next], chi[next], 1) ^ clo[prev]
var dhi = rol64hi(clo[next], chi[next], 1) ^ chi[prev]
for (let x = 0; x < 5; ++x) {
const next = (x + 1) % 5
const prev = (x + 4) % 5
const dlo = rol64lo(clo[next], chi[next], 1) ^ clo[prev]
const dhi = rol64hi(clo[next], chi[next], 1) ^ chi[prev]

for (y = 0; y < 5; ++y) {
for (let y = 0; y < 5; ++y) {
s[ilo(x, y)] ^= dlo
s[ihi(x, y)] ^= dhi
}
}
}

function rho (s) {
for (var x = 0; x < 5; ++x) {
for (var y = 0; y < 5; ++y) {
var lo = rol64lo(s[ilo(x, y)], s[ihi(x, y)], P1600_RHO_OFFSETS[index(x, y)])
var hi = rol64hi(s[ilo(x, y)], s[ihi(x, y)], P1600_RHO_OFFSETS[index(x, y)])
for (let x = 0; x < 5; ++x) {
for (let y = 0; y < 5; ++y) {
const lo = rol64lo(s[ilo(x, y)], s[ihi(x, y)], P1600_RHO_OFFSETS[index(x, y)])
const hi = rol64hi(s[ilo(x, y)], s[ihi(x, y)], P1600_RHO_OFFSETS[index(x, y)])
s[ilo(x, y)] = lo
s[ihi(x, y)] = hi
}
}
}

function pi (s) {
var ts = s.slice()
const ts = s.slice()

for (var x = 0; x < 5; ++x) {
for (var y = 0; y < 5; ++y) {
var nx = (0 * x + 1 * y) % 5
var ny = (2 * x + 3 * y) % 5
for (let x = 0; x < 5; ++x) {
for (let y = 0; y < 5; ++y) {
const nx = (0 * x + 1 * y) % 5
const ny = (2 * x + 3 * y) % 5
s[ilo(nx, ny)] = ts[ilo(x, y)]
s[ihi(nx, ny)] = ts[ihi(x, y)]
}
}
}

function chi (s) {
var clo = [0, 0, 0, 0, 0]
var chi = [0, 0, 0, 0, 0]
const clo = [0, 0, 0, 0, 0]
const chi = [0, 0, 0, 0, 0]

for (var y = 0; y < 5; ++y) {
for (var x = 0; x < 5; ++x) {
for (let y = 0; y < 5; ++y) {
for (let x = 0; x < 5; ++x) {
clo[x] = s[ilo(x, y)] ^ (~s[ilo((x + 1) % 5, y)] & s[ilo((x + 2) % 5, y)])
chi[x] = s[ihi(x, y)] ^ (~s[ihi((x + 1) % 5, y)] & s[ihi((x + 2) % 5, y)])
}

for (x = 0; x < 5; ++x) {
for (let x = 0; x < 5; ++x) {
s[ilo(x, y)] = clo[x]
s[ihi(x, y)] = chi[x]
}
Expand All @@ -115,7 +115,7 @@ function ihi (x, y) { return index(x, y) * 2 + 1 }

function rol64lo (lo, hi, shift) {
if (shift >= 32) {
var t = lo
const t = lo
lo = hi
hi = t
shift -= 32
Expand All @@ -126,7 +126,7 @@ function rol64lo (lo, hi, shift) {

function rol64hi (lo, hi, shift) {
if (shift >= 32) {
var t = lo
const t = lo
lo = hi
hi = t
shift -= 32
Expand Down
Loading

0 comments on commit f545a8d

Please sign in to comment.