Use sha3 from noble
This commit is contained in:
@@ -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"
|
||||
},
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user