@stablelib/blake2b
Advanced tools
Comparing version 0.10.4 to 0.10.5
@@ -79,2 +79,3 @@ // Copyright (C) 2017 Dmitry Chestnykh | ||
// Note: Int32Arrays for state and message are used for performance reasons. | ||
private _state = new Int32Array(IV); // hash state, initialized with IV | ||
@@ -88,2 +89,5 @@ private _buffer = new Uint8Array(BLOCK_SIZE); // buffer for data | ||
private _vtmp = new Int32Array(32); | ||
private _mtmp = new Int32Array(32); | ||
private _paddedKey: Uint8Array | undefined; // copy of zero-padded key if present | ||
@@ -300,2 +304,4 @@ private _initialState: Int32Array; // initial state after initialization | ||
clean() { | ||
wipe(this._vtmp); | ||
wipe(this._mtmp); | ||
wipe(this._state); | ||
@@ -511,3 +517,3 @@ wipe(this._buffer); | ||
this._incrementCounter(length); | ||
let v = new Uint32Array(32); | ||
let v = this._vtmp; | ||
v.set(this._state); | ||
@@ -524,3 +530,3 @@ v.set(IV, 16); | ||
let m = new Uint32Array(32); | ||
let m = this._mtmp; | ||
for (let i = 0; i < 32; i++) { | ||
@@ -527,0 +533,0 @@ m[i] = readUint32LE(this._buffer, i * 4); |
@@ -36,2 +36,4 @@ import { SerializableHash } from "@stablelib/hash"; | ||
private _finished; | ||
private _vtmp; | ||
private _mtmp; | ||
private _paddedKey; | ||
@@ -38,0 +40,0 @@ private _initialState; |
@@ -62,2 +62,4 @@ "use strict"; | ||
this._finished = false; | ||
this._vtmp = new Int32Array(32); | ||
this._mtmp = new Int32Array(32); | ||
// Validate digest length. | ||
@@ -242,2 +244,4 @@ if (digestLength < 1 || digestLength > exports.DIGEST_LENGTH) { | ||
BLAKE2b.prototype.clean = function () { | ||
wipe_1.wipe(this._vtmp); | ||
wipe_1.wipe(this._mtmp); | ||
wipe_1.wipe(this._state); | ||
@@ -428,3 +432,3 @@ wipe_1.wipe(this._buffer); | ||
this._incrementCounter(length); | ||
var v = new Uint32Array(32); | ||
var v = this._vtmp; | ||
v.set(this._state); | ||
@@ -440,5 +444,6 @@ v.set(IV, 16); | ||
v[15 * 2 + 1] ^= this._flag[3]; | ||
var m = new Uint32Array(32); | ||
var m = this._mtmp; | ||
var mv = new DataView(this._buffer.buffer); | ||
for (var i = 0; i < 32; i++) { | ||
m[i] = binary_1.readUint32LE(this._buffer, i * 4); | ||
m[i] = mv.getUint32(i * 4, true); | ||
} | ||
@@ -445,0 +450,0 @@ for (var r = 0; r < 12; r++) { |
{ | ||
"name": "@stablelib/blake2b", | ||
"version": "0.10.4", | ||
"version": "0.10.5", | ||
"description": "BLAKE2b cryptographic hash function", | ||
@@ -5,0 +5,0 @@ "main": "./lib/blake2b.js", |
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
225128
2320