Use sha3 from noble

This commit is contained in:
Simon Warta
2022-01-26 21:32:35 +01:00
parent 4a6253f16b
commit 218c341f67
5 changed files with 3 additions and 31 deletions
-1
View File
@@ -48,7 +48,6 @@
"bip39": "^3.0.2",
"bn.js": "^5.2.0",
"elliptic": "^6.5.3",
"js-sha3": "^0.8.0",
"libsodium-wrappers": "^0.7.6",
"sha.js": "^2.4.11"
},
+3 -5
View File
@@ -1,15 +1,13 @@
import jssha3 from "js-sha3";
import { keccak_256 } from "@noble/hashes/sha3";
import { HashFunction } from "./hash";
export class Keccak256 implements HashFunction {
public readonly blockSize = 512 / 8;
private readonly impl: jssha3.Hasher;
private readonly impl = keccak_256.create();
public constructor(firstData?: Uint8Array) {
this.impl = jssha3.keccak256.create();
if (firstData) {
this.update(firstData);
}
@@ -21,7 +19,7 @@ export class Keccak256 implements HashFunction {
}
public digest(): Uint8Array {
return new Uint8Array(this.impl.digest());
return this.impl.digest();
}
}