chacha20-universal
Advanced tools
Comparing version 1.0.1 to 1.0.2
22
index.js
@@ -19,3 +19,3 @@ const assert = require('nanoassert') | ||
for (let i = 0; i < 4; i++) this.state[i] = constant[i] | ||
for (let i = 0; i < 8; i++) this.state[4 + i] = k.readUInt32LE(4 * i) | ||
for (let i = 0; i < 8; i++) this.state[4 + i] = readUInt32LE(k, 4 * i) | ||
@@ -26,8 +26,8 @@ this.state[12] = counter & 0xffffffff | ||
this.state[13] = (counter && 0xffffffff00000000) >> 32 | ||
this.state[14] = n.readUInt32LE(0) | ||
this.state[15] = n.readUInt32LE(4) | ||
this.state[14] = readUInt32LE(n, 0) | ||
this.state[15] = readUInt32LE(n, 4) | ||
} else { | ||
this.state[13] = n.readUInt32LE(0) | ||
this.state[14] = n.readUInt32LE(4) | ||
this.state[15] = n.readUInt32LE(8) | ||
this.state[13] = readUInt32LE(n, 0) | ||
this.state[14] = readUInt32LE(n, 4) | ||
this.state[15] = readUInt32LE(n, 8) | ||
} | ||
@@ -135,1 +135,11 @@ | ||
} | ||
function readUInt32LE (buf, offset) { | ||
if (Buffer.isBuffer(buf)) return buf.readUInt32LE(offset) | ||
else if (buf instanceof Uint8Array) { | ||
var ret = 0 | ||
for (let i = 0; i < 4; i++) ret |= buf[offset + i] << (8 * i) | ||
return ret | ||
} | ||
assert(false, 'buf should be a Buffer or a Uint8Array') | ||
} |
{ | ||
"name": "chacha20-universal", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "chacha20 in pure javascript", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
28177
501