Skip to content

Commit

Permalink
Improved formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
vrza committed Feb 24, 2023
1 parent 0090de4 commit a565ccd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
6 changes: 3 additions & 3 deletions leaktest.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@ function randomElement(arr) {
const algos = ['blake2b', 'blake2s', 'blake2bp', 'blake2sp'];
const encodings = [undefined, 'hex', 'base64', 'binary'];
let input = Buffer.from(String(Math.random()));
while(1) {
while (1) {
let hash = new blake2.Hash(randomElement(algos));
hash.update(input);
input = hash.digest(randomElement(encodings));
hash = hash.copy(); // Exercise copy as well
if(typeof input === 'string') {
if (typeof input === 'string') {
input = Buffer.from(input.substr(0, 16));
}

hash = new blake2.KeyedHash(randomElement(algos), Buffer.from(String(Math.random())));
hash.update(input);
hash = hash.copy(); // Exercise copy as well
input = hash.digest(randomElement(encodings));
if(typeof input === 'string') {
if (typeof input === 'string') {
input = Buffer.from(input.substr(0, 16));
}
}
1 change: 0 additions & 1 deletion src/blake2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,5 +248,4 @@ class Hash: public Nan::ObjectWrap {
}
};


NAN_MODULE_WORKER_ENABLED(NODE_GYP_MODULE_NAME, Hash::Init)

0 comments on commit a565ccd

Please sign in to comment.