pull/5370/head
aniket-engg 1 year ago committed by Aniket
parent 4cbf6a362c
commit 5687198f62
  1. 13
      libs/remix-ws-templates/src/templates/hashchecker/scripts/run_setup.ts
  2. 11
      libs/remix-ws-templates/src/templates/hashchecker/scripts/run_verification.ts

@ -1,5 +1,3 @@
import { ethers, BigNumber } from 'ethers'
// eslint-disable-next-line @typescript-eslint/no-var-requires
const snarkjs = require('snarkjs');
@ -8,17 +6,6 @@ const logger = {
debug: (...args) => console.log(...args)
};
/**
* Creates a keccak256 hash of a message compatible with the SNARK scalar modulus.
* @param message The message to be hashed.
* @returns The message digest.
*/
function hash(message: any): bigint {
message = BigNumber.from(message).toTwos(256).toHexString()
message = ethers.utils.zeroPad(message, 32)
return BigInt(ethers.utils.keccak256(message)) >> BigInt(8)
}
(async () => {
try {
// @ts-ignore

@ -9,17 +9,6 @@ const logger = {
error: (...args) => console.error(...args),
}
/**
* Creates a keccak256 hash of a message compatible with the SNARK scalar modulus.
* @param message The message to be hashed.
* @returns The message digest.
*/
function hash(message: any): bigint {
message = BigNumber.from(message).toTwos(256).toHexString()
message = ethers.utils.zeroPad(message, 32)
return BigInt(ethers.utils.keccak256(message)) >> BigInt(8)
}
(async () => {
try {
// @ts-ignore

Loading…
Cancel
Save