Replace ripemd160 dependencies with @noble/hashes
This commit is contained in:
parent
b17e519524
commit
4a6253f16b
30
.pnp.cjs
generated
30
.pnp.cjs
generated
@ -342,6 +342,10 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
"@ledgerhq/logs",
|
||||
"npm:5.50.0"
|
||||
],
|
||||
[
|
||||
"@noble/hashes",
|
||||
"npm:1.0.0"
|
||||
],
|
||||
[
|
||||
"@nodelib/fs.scandir",
|
||||
"npm:2.1.4"
|
||||
@ -582,10 +586,6 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
"@types/range-parser",
|
||||
"npm:1.2.3"
|
||||
],
|
||||
[
|
||||
"@types/ripemd160",
|
||||
"npm:2.0.0"
|
||||
],
|
||||
[
|
||||
"@types/semver",
|
||||
"npm:7.3.6"
|
||||
@ -3372,6 +3372,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
["@cosmjs/math", "workspace:packages/math"],
|
||||
["@cosmjs/utils", "workspace:packages/utils"],
|
||||
["@istanbuljs/nyc-config-typescript", "virtual:4f1584ad4aba8733a24be7c8aebbffafef25607f2d00f4b314cf96717145c692763628a31c2b85d4686fbb091ff21ebffa3cc337399c042c19a32b9bdb786464#npm:1.0.1"],
|
||||
["@noble/hashes", "npm:1.0.0"],
|
||||
["@types/bn.js", "npm:5.1.0"],
|
||||
["@types/elliptic", "npm:6.4.12"],
|
||||
["@types/eslint-plugin-prettier", "npm:3.1.0"],
|
||||
@ -3381,7 +3382,6 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
["@types/karma-jasmine-html-reporter", "npm:1.5.1"],
|
||||
["@types/libsodium-wrappers", "npm:0.7.9"],
|
||||
["@types/node", "npm:15.3.1"],
|
||||
["@types/ripemd160", "npm:2.0.0"],
|
||||
["@types/sha.js", "npm:2.4.0"],
|
||||
["@typescript-eslint/eslint-plugin", "virtual:4f1584ad4aba8733a24be7c8aebbffafef25607f2d00f4b314cf96717145c692763628a31c2b85d4686fbb091ff21ebffa3cc337399c042c19a32b9bdb786464#npm:4.28.4"],
|
||||
["@typescript-eslint/parser", "virtual:4f1584ad4aba8733a24be7c8aebbffafef25607f2d00f4b314cf96717145c692763628a31c2b85d4686fbb091ff21ebffa3cc337399c042c19a32b9bdb786464#npm:4.28.4"],
|
||||
@ -3409,7 +3409,6 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
["libsodium-wrappers", "npm:0.7.9"],
|
||||
["nyc", "npm:15.1.0"],
|
||||
["prettier", "npm:2.4.1"],
|
||||
["ripemd160", "npm:2.0.2"],
|
||||
["ses", "npm:0.11.1"],
|
||||
["sha.js", "npm:2.4.11"],
|
||||
["source-map-support", "npm:0.5.19"],
|
||||
@ -4224,6 +4223,15 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
"linkType": "HARD",
|
||||
}]
|
||||
]],
|
||||
["@noble/hashes", [
|
||||
["npm:1.0.0", {
|
||||
"packageLocation": "./.yarn/cache/@noble-hashes-npm-1.0.0-893cbd74b3-bdf1c28a4b.zip/node_modules/@noble/hashes/",
|
||||
"packageDependencies": [
|
||||
["@noble/hashes", "npm:1.0.0"]
|
||||
],
|
||||
"linkType": "HARD",
|
||||
}]
|
||||
]],
|
||||
["@nodelib/fs.scandir", [
|
||||
["npm:2.1.4", {
|
||||
"packageLocation": "./.yarn/cache/@nodelib-fs.scandir-npm-2.1.4-6f6ddb2372-18c2150ab5.zip/node_modules/@nodelib/fs.scandir/",
|
||||
@ -4847,16 +4855,6 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
"linkType": "HARD",
|
||||
}]
|
||||
]],
|
||||
["@types/ripemd160", [
|
||||
["npm:2.0.0", {
|
||||
"packageLocation": "./.yarn/cache/@types-ripemd160-npm-2.0.0-0e635eba3e-eb0eb2d380.zip/node_modules/@types/ripemd160/",
|
||||
"packageDependencies": [
|
||||
["@types/ripemd160", "npm:2.0.0"],
|
||||
["@types/node", "npm:15.3.1"]
|
||||
],
|
||||
"linkType": "HARD",
|
||||
}]
|
||||
]],
|
||||
["@types/semver", [
|
||||
["npm:7.3.6", {
|
||||
"packageLocation": "./.yarn/cache/@types-semver-npm-7.3.6-4add0df8f9-933b115a59.zip/node_modules/@types/semver/",
|
||||
|
||||
BIN
.yarn/cache/@noble-hashes-npm-1.0.0-893cbd74b3-bdf1c28a4b.zip
(Stored with Git LFS)
vendored
Normal file
BIN
.yarn/cache/@noble-hashes-npm-1.0.0-893cbd74b3-bdf1c28a4b.zip
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/@types-ripemd160-npm-2.0.0-0e635eba3e-eb0eb2d380.zip
(Stored with Git LFS)
vendored
BIN
.yarn/cache/@types-ripemd160-npm-2.0.0-0e635eba3e-eb0eb2d380.zip
(Stored with Git LFS)
vendored
Binary file not shown.
@ -44,12 +44,12 @@
|
||||
"@cosmjs/encoding": "workspace:packages/encoding",
|
||||
"@cosmjs/math": "workspace:packages/math",
|
||||
"@cosmjs/utils": "workspace:packages/utils",
|
||||
"@noble/hashes": "^1",
|
||||
"bip39": "^3.0.2",
|
||||
"bn.js": "^5.2.0",
|
||||
"elliptic": "^6.5.3",
|
||||
"js-sha3": "^0.8.0",
|
||||
"libsodium-wrappers": "^0.7.6",
|
||||
"ripemd160": "^2.0.2",
|
||||
"sha.js": "^2.4.11"
|
||||
},
|
||||
"devDependencies": {
|
||||
@ -63,7 +63,6 @@
|
||||
"@types/karma-jasmine-html-reporter": "^1",
|
||||
"@types/libsodium-wrappers": "^0.7.7",
|
||||
"@types/node": "^15.0.1",
|
||||
"@types/ripemd160": "^2.0.0",
|
||||
"@types/sha.js": "^2.4.0",
|
||||
"@typescript-eslint/eslint-plugin": "^4.28",
|
||||
"@typescript-eslint/parser": "^4.28",
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
import RIPEMD160 from "ripemd160";
|
||||
import { ripemd160 as nobleRipemd160 } from "@noble/hashes/ripemd160";
|
||||
|
||||
import { HashFunction } from "./hash";
|
||||
|
||||
export class Ripemd160 implements HashFunction {
|
||||
public readonly blockSize = 512 / 8;
|
||||
|
||||
private readonly impl = new RIPEMD160();
|
||||
private readonly impl = nobleRipemd160.create();
|
||||
|
||||
public constructor(firstData?: Uint8Array) {
|
||||
if (firstData) {
|
||||
@ -14,12 +14,12 @@ export class Ripemd160 implements HashFunction {
|
||||
}
|
||||
|
||||
public update(data: Uint8Array): Ripemd160 {
|
||||
this.impl.update(Buffer.from(data));
|
||||
this.impl.update(data);
|
||||
return this;
|
||||
}
|
||||
|
||||
public digest(): Uint8Array {
|
||||
return Uint8Array.from(this.impl.digest());
|
||||
return this.impl.digest();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
19
yarn.lock
19
yarn.lock
@ -455,6 +455,7 @@ __metadata:
|
||||
"@cosmjs/math": "workspace:packages/math"
|
||||
"@cosmjs/utils": "workspace:packages/utils"
|
||||
"@istanbuljs/nyc-config-typescript": ^1.0.1
|
||||
"@noble/hashes": ^1
|
||||
"@types/bn.js": ^5
|
||||
"@types/elliptic": ^6.4.12
|
||||
"@types/eslint-plugin-prettier": ^3
|
||||
@ -464,7 +465,6 @@ __metadata:
|
||||
"@types/karma-jasmine-html-reporter": ^1
|
||||
"@types/libsodium-wrappers": ^0.7.7
|
||||
"@types/node": ^15.0.1
|
||||
"@types/ripemd160": ^2.0.0
|
||||
"@types/sha.js": ^2.4.0
|
||||
"@typescript-eslint/eslint-plugin": ^4.28
|
||||
"@typescript-eslint/parser": ^4.28
|
||||
@ -492,7 +492,6 @@ __metadata:
|
||||
libsodium-wrappers: ^0.7.6
|
||||
nyc: ^15.1.0
|
||||
prettier: ^2.4.1
|
||||
ripemd160: ^2.0.2
|
||||
ses: ^0.11.0
|
||||
sha.js: ^2.4.11
|
||||
source-map-support: ^0.5.19
|
||||
@ -1248,6 +1247,13 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@noble/hashes@npm:^1":
|
||||
version: 1.0.0
|
||||
resolution: "@noble/hashes@npm:1.0.0"
|
||||
checksum: bdf1c28a4b587e72ec6b0c504903239c6f96680b2c15a6d90d367512f468eeca12f2ee7bd25967a9529be2bedbf3f8d0a50c33368937f8dfef2a973d0661c7b5
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@nodelib/fs.scandir@npm:2.1.4":
|
||||
version: 2.1.4
|
||||
resolution: "@nodelib/fs.scandir@npm:2.1.4"
|
||||
@ -1779,15 +1785,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/ripemd160@npm:^2.0.0":
|
||||
version: 2.0.0
|
||||
resolution: "@types/ripemd160@npm:2.0.0"
|
||||
dependencies:
|
||||
"@types/node": "*"
|
||||
checksum: eb0eb2d380734a957a1e584f22af874552fe2ce1b28bc079ea5e361dec4bfcee5285d34dc6acdbce31616ac93210343a6c92809a45e18e3b3fd7f462c65b5166
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/semver@npm:^7.3.4":
|
||||
version: 7.3.6
|
||||
resolution: "@types/semver@npm:7.3.6"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user