Skip to content

Commit

Permalink
Use sha3 from noble
Browse files Browse the repository at this point in the history
  • Loading branch information
webmaster128 committed Jan 26, 2022
1 parent 4a6253f commit 218c341
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 31 deletions.
14 changes: 0 additions & 14 deletions .pnp.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions .yarn/cache/js-sha3-npm-0.8.0-decf3ddcfa-75df77c1fc.zip

This file was deleted.

1 change: 0 additions & 1 deletion packages/crypto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
8 changes: 3 additions & 5 deletions packages/crypto/src/keccak.ts
Original file line number Diff line number Diff line change
@@ -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);
}
Expand All @@ -21,7 +19,7 @@ export class Keccak256 implements HashFunction {
}

public digest(): Uint8Array {
return new Uint8Array(this.impl.digest());
return this.impl.digest();
}
}

Expand Down
8 changes: 0 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,6 @@ __metadata:
jasmine: ^3.8
jasmine-core: ^3.7.1
jasmine-spec-reporter: ^6
js-sha3: ^0.8.0
karma: ^6.1.1
karma-chrome-launcher: ^3.1.0
karma-firefox-launcher: ^2.1.0
Expand Down Expand Up @@ -4848,13 +4847,6 @@ fsevents@~2.3.1:
languageName: node
linkType: hard

"js-sha3@npm:^0.8.0":
version: 0.8.0
resolution: "js-sha3@npm:0.8.0"
checksum: 75df77c1fc266973f06cce8309ce010e9e9f07ec35ab12022ed29b7f0d9c8757f5a73e1b35aa24840dced0dea7059085aa143d817aea9e188e2a80d569d9adce
languageName: node
linkType: hard

"js-sha512@npm:^0.8.0":
version: 0.8.0
resolution: "js-sha512@npm:0.8.0"
Expand Down

0 comments on commit 218c341

Please sign in to comment.