Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Commit 68b58a4

Browse files
committed
switch to using blake2b for hashing
1 parent 9f06e7e commit 68b58a4

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

packages/web3-validator/src/web3_validator.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ along with web3.js. If not, see <http://www.gnu.org/licenses/>.
1616
*/
1717

1818
import Ajv from 'ajv';
19-
import { sha256 } from 'ethereum-cryptography/sha256';
19+
import { blake2b } from 'ethereum-cryptography/blake2b';
2020
import { utf8ToBytes, toHex } from 'ethereum-cryptography/utils';
2121
import { ethAbiToJsonSchema } from './utils';
2222
import { ValidationSchemaInput, Web3ValidationErrorObject, Web3ValidationOptions } from './types';
@@ -100,7 +100,7 @@ export class Web3Validator {
100100
]);
101101
}
102102

103-
const schemaKey = toHex(sha256(utf8ToBytes(JSON.stringify(jsonSchema))));
103+
const schemaKey = toHex(blake2b(utf8ToBytes(JSON.stringify(jsonSchema)), 128));
104104
if (!this._validator.getSchema(schemaKey)) {
105105
this._validator.addSchema(jsonSchema, schemaKey);
106106
}

0 commit comments

Comments
 (0)