Skip to content

Commit

Permalink
chore: remove pedersen hash oracle (#3023)
Browse files Browse the repository at this point in the history
Replaces the pedersen hash oracle with the pedersen hash opcode.

Co-authored-by: Álvaro Rodríguez <[email protected]>
  • Loading branch information
2 people authored and Maddiaa0 committed Oct 25, 2023
1 parent d0f47c5 commit 3a1b242
Show file tree
Hide file tree
Showing 19 changed files with 85 additions and 122 deletions.
2 changes: 1 addition & 1 deletion barretenberg/acir_tests/run_acir_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ set -eu
BIN=${BIN:-../cpp/build/bin/bb}
FLOW=${FLOW:-prove_and_verify}
CRS_PATH=~/.bb-crs
BRANCH=arv/pedersen_hash
BRANCH=master
VERBOSE=${VERBOSE:-}
NAMED_TEST=${1:-}

Expand Down
2 changes: 1 addition & 1 deletion yarn-project/acir-simulator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@aztec/circuits.js": "workspace:^",
"@aztec/foundation": "workspace:^",
"@aztec/types": "workspace:^",
"@kevaundray/acvm_js": "0.29.0-kw-switch-backend-e9641725f",
"@noir-lang/acvm_js": "0.30.0",
"levelup": "^5.1.1",
"memdown": "^6.1.1",
"tslib": "^2.4.0"
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/acir-simulator/src/acvm/acvm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
WasmBlackBoxFunctionSolver,
WitnessMap,
executeCircuitWithBlackBoxSolver,
} from '@kevaundray/acvm_js';
} from '@noir-lang/acvm_js';

import { traverseCauseChain } from '../common/errors.js';
import { ORACLE_NAMES } from './oracle/index.js';
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/acir-simulator/src/acvm/deserialize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { EthAddress } from '@aztec/foundation/eth-address';
import { Fr, Point } from '@aztec/foundation/fields';
import { Tuple } from '@aztec/foundation/serialize';

import { getReturnWitness } from '@kevaundray/acvm_js';
import { getReturnWitness } from '@noir-lang/acvm_js';

import { ACVMField, ACVMWitness } from './acvm.js';

Expand Down
2 changes: 1 addition & 1 deletion yarn-project/acir-simulator/src/acvm/oracle/debug.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ForeignCallInput } from '@kevaundray/acvm_js';
import { ForeignCallInput } from '@noir-lang/acvm_js';

import { ACVMField } from '../acvm.js';

Expand Down
5 changes: 0 additions & 5 deletions yarn-project/acir-simulator/src/acvm/oracle/oracle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,4 @@ export class Oracle {
);
return toAcvmEnqueuePublicFunctionResult(enqueuedRequest);
}

async pedersenHash(inputs: ACVMField[], [hashIndex]: ACVMField[]) {
const hash = await this.typedOracle.perdersenHash(inputs.map(fromACVMField), +hashIndex);
return toACVMField(hash);
}
}
13 changes: 1 addition & 12 deletions yarn-project/acir-simulator/src/acvm/oracle/typed_oracle.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { CircuitsWasm, PrivateCallStackItem, PublicCallRequest } from '@aztec/circuits.js';
import { pedersenCompressWithHashIndex } from '@aztec/circuits.js/barretenberg';
import { PrivateCallStackItem, PublicCallRequest } from '@aztec/circuits.js';
import { FunctionSelector } from '@aztec/foundation/abi';
import { AztecAddress } from '@aztec/foundation/aztec-address';
import { EthAddress } from '@aztec/foundation/eth-address';
Expand Down Expand Up @@ -153,14 +152,4 @@ export abstract class TypedOracle {
): Promise<PublicCallRequest> {
throw new Error('Not available.');
}

async perdersenHash(inputs: Fr[], hashIndex: number): Promise<Fr> {
const wasm = await CircuitsWasm.get();
const hash = pedersenCompressWithHashIndex(
wasm,
inputs.map(i => i.toBuffer()),
hashIndex,
);
return Fr.fromBuffer(hash);
}
}
2 changes: 1 addition & 1 deletion yarn-project/acir-simulator/src/client/simulator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Fr } from '@aztec/foundation/fields';
import { DebugLogger, createDebugLogger } from '@aztec/foundation/log';
import { AztecNode, FunctionCall, TxExecutionRequest } from '@aztec/types';

import { WasmBlackBoxFunctionSolver, createBlackBoxSolver } from '@kevaundray/acvm_js';
import { WasmBlackBoxFunctionSolver, createBlackBoxSolver } from '@noir-lang/acvm_js';

import { createSimulationError } from '../common/errors.js';
import { SideEffectCounter } from '../common/index.js';
Expand Down
21 changes: 2 additions & 19 deletions yarn-project/aztec-nr/aztec/src/hash.nr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use dep::std::hash::{pedersen_with_separator, sha256};
use dep::std::hash::{pedersen_hash_with_separator, sha256};
use crate::constants_gen::{
GENERATOR_INDEX__SIGNATURE_PAYLOAD,
GENERATOR_INDEX__L1_TO_L2_MESSAGE_SECRET,
Expand Down Expand Up @@ -29,23 +29,6 @@ pub fn compute_secret_hash(secret: Field) -> Field {
pedersen_hash([secret], GENERATOR_INDEX__L1_TO_L2_MESSAGE_SECRET)
}

#[oracle(pedersenHash)]
fn pedersen_hash_oracle<N>(_inputs: [Field; N], _hash_index: u32) -> Field {}

unconstrained fn pedersen_hash_internal<N>(inputs: [Field; N], hash_index: u32) -> Field {
pedersen_hash_oracle(inputs, hash_index)
}

// TODO(Kev): We can move this into the noir std-lib
// as an acir opcode, once we have the pedersen PR merged.
pub fn pedersen_hash<N>(inputs: [Field; N], hash_index: u32) -> Field {
// Temporary hack. This is not right. Kev forced me to do this. Blame him.
pedersen_hash_internal(inputs, hash_index)
// let input_size = inputs.len();
// let mut modified_inputs = [];
// modified_inputs = modified_inputs.push_back(input_size as Field);
// for i in 0..N {
// modified_inputs = modified_inputs.push_back(inputs[i]);
// }
// pedersen_with_separator(modified_inputs, hash_index)[0]
pedersen_hash_with_separator(inputs, hash_index)
}
12 changes: 6 additions & 6 deletions yarn-project/aztec.js/src/artifacts/ecdsa_account_contract.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions yarn-project/boxes/blank-react/src/artifacts/Blank.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"isInternal": false,
"parameters": [],
"returnTypes": [],
"bytecode": "H4sIAAAAAAAA/+XdVXNbVxSGYduJ7TLXYWZqJUuypGKaMqeYchM1crlNMeWmaRtmZmZOfmHWO5FnPLnNvtnznplvbN149FjS0YG117rS1tZ2sO3a1h7piHS2fh943HXd4+7W74O3gcdzWz9Lhb5yuVntbRZLxUWF3nqjVimUK42+WrFWrNQqi3trpVKzVq5V6416tVAvlkvNYn+lXuovXNuGDfpbhRvcBj/PjuueZ+HGtmJ7QvPwTMwdCc0jMjEPSWgemYl5aELzqEzMnQnNozMxdyU0j8nE3J3QPDYT87CE5nFC83iheYLQPFFoniQ0TxaapwjNU4XmaULzdKF5htA8U2ieJTTPFprnCM0PCM0PCs0FobkoNPcKzSWhuSw0V4TmPqG5KjTXhOa60PyQ0Pyw0PyI0Pyo0PyY0Py40DxXaH5CaJ4nND8pND8lND8tND8jND8rND8nND8vNL8gNL8oNL8kNL8sNL8iNL8qNM8Xml8Tml8Xmt8Qmt8Umt8Smt8WmhcIze8Ize8Kze8Jze8LzR8IzR8KzR8JzR8LzQuF5kVCc0No/kRoXiw0N4XmfqH5U6H5M6H5c6H5C6H5S6H5K6H5a6H5G6H5W6F5idD8ndD8vdD8g9D8o9D8k9D8s9C8VGj+RWj+VWj+TWj+XWj+Q2j+U2j+S2j+W2heJjT/IzQvF5r/FZr/E5r/F5pXCM0rheZVQvNqoXmN0LxWaF4nNK8XmjcIzRuF5k1C82aheYvQvFVo3iY0bxeadwjNO4XmXULzbqF5j9C8V2jeJzTvF5oPCM0HheZDQvNhofmI0Hw0E/NNCc3HMjHfnNB8PBPzLQnNJzIx35rQfDIT820JzacyMd+e0Hw6E/MdCc1nMjHfmdB8NhPzXQnN5zIx353QfD4T8z0JzRcyMd+b0HwxE/N9Cc2XMjHfn9B8ORNzT0LzlYTmntbfaW+Zh0SGRjojXZHuCOeEnCNxzsAxNMeUHGN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LzYqH5OaH5eaH5BaH5RaH5JaH5ZaH5FaH5VaF5idC8VGhuC82vCc3LhOaO0DwoNL8uNL8hNL8pNL8lNL8tNL8jNL8rNL8nNL8vNC8Xmj8Qmj8Umj8Smj8Wmj8Rmj8VmlcIzZ8JzZ8LzV8IzV8KzV8JzV8Lzd8Izd8KzSuF5u+E5lVC8/dC8w9C849C809C889C8y9C869C829C8+9C8x9C859C819C899C8z9C879C839C8/9C82qheY3QvFZoXic0rxeaNwjNG4XmTULzZqF5i9C8VWjeJjRvF5p3CM07heZdmZgvSWjenYn50oTmPZmYL0to3puJ+fKE5n2ZmK9IaN6fifnKhOYDmZivSmg+mIn56oTmQ5mYr0loPpyJ+dqE5iOZmK9LaD6aifn6hOZjmZhvSGg+non5xoTmE5mY+xKaTyY093W309s1D4+MiBQixUgpwjUh10hcM3AOzTkl51icc3AM5pjEPpp9Fv/D/Kb5jvvO+ntu6r6PioyOjImMjYyLjI9MiEyMTIpMjkyJTI1Mi0yPzIjMjMyKzI7MicyNzIvMjzDjnpnvfInMBGdGNjOjmaHMTGFm7DYizGBlJikzOplZyQxHZhoy4+/0zDtmoi2MMDOLGVLMVGLGEDN3mEHDTBZmlDCzgxkWzHRgxgE9/xdF6AlPj3R6htNDm57S9FheHKEHLz1p6dFKz1J6eNLTkh6P9DxcEqEnXjtCzzR6iNFTix5T9FyiBxE9eehRQ88WepjQ04MeF/R8WB6hJwBr5Fkzzhpq1hSzxnZFhDWYrElkjR5r1ljDxZom1viw5mVlhDURqyLUzFNDTk01NcbU3FKDSk0mNYrU7FHDRk0XNU7U/FADQ00INRLUDPAMnWfKPGPlmSPP4HgmxTMafhPcw+eeNvd4uee5PcI9Me4Rcc+EewhcU3ONyTUX1yCck3OOyjkb5zAc0znGsc9nH8g+gf+R069TXMw0LzyaAAA=",
"verificationKey": "0000000200000800000000740000000f00000003515f3109623eb3c25aa5b16a1a79fd558bac7a7ce62c4560a8c537c77ce80dd339128d1d37b6582ee9e6df9567efb64313471dfa18f520f9ce53161b50dbf7731bc5f900000003515f322bc4cce83a486a92c92fd59bd84e0f92595baa639fc2ed86b00ffa0dfded2a092a669a3bdb7a273a015eda494457cc7ed5236f26cee330c290d45a33b9daa94800000003515f332729426c008c085a81bd34d8ef12dd31e80130339ef99d50013a89e4558eee6d0fa4ffe2ee7b7b62eb92608b2251ac31396a718f9b34978888789042b790a30100000003515f342be6b6824a913eb7a57b03cb1ee7bfb4de02f2f65fe8a4e97baa7766ddb353a82a8a25c49dc63778cd9fe96173f12a2bc77f3682f4c4448f98f1df82c75234a100000003515f351f85760d6ab567465aadc2f180af9eae3800e6958fec96aef53fd8a7b195d7c000c6267a0dd5cfc22b3fe804f53e266069c0e36f51885baec1e7e67650c62e170000000c515f41524954484d455449430d9d0f8ece2aa12012fa21e6e5c859e97bd5704e5c122064a66051294bc5e04213f61f54a0ebdf6fee4d4a6ecf693478191de0c2899bcd8e86a636c8d3eff43400000003515f43224a99d02c86336737c8dd5b746c40d2be6aead8393889a76a18d664029096e90f7fe81adcc92a74350eada9622ac453f49ebac24a066a1f83b394df54dfa0130000000c515f46495845445f42415345060e8a013ed289c2f9fd7473b04f6594b138ddb4b4cf6b901622a14088f04b8d2c83ff74fce56e3d5573b99c7b26d85d5046ce0c6559506acb7a675e7713eb3a00000007515f4c4f4749430721a91cb8da4b917e054f72147e1760cfe0ef3d45090ac0f4961d84ec1996961a25e787b26bd8b50b1a99450f77a424a83513c2b33af268cd253b0587ff50c700000003515f4d05dbd8623b8652511e1eb38d38887a69eceb082f807514f09e127237c5213b401b9325b48c6c225968002318095f89d0ef9cf629b2b7f0172e03bc39aacf6ed800000007515f52414e474504b57a3805e41df328f5ca9aefa40fad5917391543b7b65c6476e60b8f72e9ad07c92f3b3e11c8feae96dedc4b14a6226ef3201244f37cfc1ee5b96781f48d2b000000075349474d415f3125001d1954a18571eaa007144c5a567bb0d2be4def08a8be918b8c05e3b27d312c59ed41e09e144eab5de77ca89a2fd783be702a47c951d3112e3de02ce6e47c000000075349474d415f3223994e6a23618e60fa01c449a7ab88378709197e186d48d604bfb6931ffb15ad11c5ec7a0700570f80088fd5198ab5d5c227f2ad2a455a6edeec024156bb7beb000000075349474d415f3300cda5845f23468a13275d18bddae27c6bb189cf9aa95b6a03a0cb6688c7e8d829639b45cf8607c525cc400b55ebf90205f2f378626dc3406cc59b2d1b474fba000000075349474d415f342d299e7928496ea2d37f10b43afd6a80c90a33b483090d18069ffa275eedb2fc2f82121e8de43dc036d99b478b6227ceef34248939987a19011f065d8b5cef5c0000000010000000000000000100000002000000030000000400000005000000060000000700000008000000090000000a0000000b0000000c0000000d0000000e0000000f"
},
{
Expand All @@ -24,15 +24,15 @@
}
],
"returnTypes": [],
"bytecode": "H4sIAAAAAAAA/+3d93fTVhQHcCmOHSijdAYSRtgbJMtO7A6a0EVLR7o3xY4VSJumaRza0kEp3ZvuQQeldG82/x33e5DOeRHhJ65P/M5XOuee2JA86yNL1pP83r2nHcc57JxdXIkWiWz0OH6eSzxvix5noufx33Y5Exc3+tkb/fQubPHb9dryEquatpu2m7abtpu2m7abtpu2m7abttuU7eq1nR9wjTbnSsyIHk93zvbtsbjGv7Uk1iOnv05ezlG/bvBwPdNmOOIl9syWmCYxM3o+GtbCsXo4sqVS32luo9bE37nG4y7j9zLGa2UTf2tux/j/4uupCUuvDt5PXqTNSbyO9kXaXCc9WNN203bTdtN2p6pdvbYndhLmOc3QSfCt7SSY596m6ySc07jT3HdwXWMd443ZIdEpMV9i1iQbM170d0qvYTtlznDEi7lT4v9bdV83MA/u5L6Q3G6O8fo4QBZEj3eE4/27qsNDA1vD3X0jtf7K2PhQZbivVhsL6/XJ3rzMJC/UYuCzid+b8q70+baQ1ut1OPqnCO117LRgHec3YB0bsH8NmjsujqKpP9V6ga2nWvPYbKpTrTMJOG478LoLhbAnH/qBX/Hy5Wqp6BWK1e6SX/KLpWItXwqCsFQo9ZSr5R6v7BeC0B8sloPBqHHF06u/wGnMQeMqmxc2aD2T7413YYvvKpoXWWJuUTR3W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c4560a8c537c77ce80dd339128d1d37b6582ee9e6df9567efb64313471dfa18f520f9ce53161b50dbf7731bc5f900000003515f322bc4cce83a486a92c92fd59bd84e0f92595baa639fc2ed86b00ffa0dfded2a092a669a3bdb7a273a015eda494457cc7ed5236f26cee330c290d45a33b9daa94800000003515f332729426c008c085a81bd34d8ef12dd31e80130339ef99d50013a89e4558eee6d0fa4ffe2ee7b7b62eb92608b2251ac31396a718f9b34978888789042b790a30100000003515f342be6b6824a913eb7a57b03cb1ee7bfb4de02f2f65fe8a4e97baa7766ddb353a82a8a25c49dc63778cd9fe96173f12a2bc77f3682f4c4448f98f1df82c75234a100000003515f351f85760d6ab567465aadc2f180af9eae3800e6958fec96aef53fd8a7b195d7c000c6267a0dd5cfc22b3fe804f53e266069c0e36f51885baec1e7e67650c62e170000000c515f41524954484d455449430d9d0f8ece2aa12012fa21e6e5c859e97bd5704e5c122064a66051294bc5e04213f61f54a0ebdf6fee4d4a6ecf693478191de0c2899bcd8e86a636c8d3eff43400000003515f43224a99d02c86336737c8dd5b746c40d2be6aead8393889a76a18d664029096e90f7fe81adcc92a74350eada9622ac453f49ebac24a066a1f83b394df54dfa0130000000c515f46495845445f42415345060e8a013ed289c2f9fd7473b04f6594b138ddb4b4cf6b901622a14088f04b8d2c83ff74fce56e3d5573b99c7b26d85d5046ce0c6559506acb7a675e7713eb3a00000007515f4c4f4749430721a91cb8da4b917e054f72147e1760cfe0ef3d45090ac0f4961d84ec1996961a25e787b26bd8b50b1a99450f77a424a83513c2b33af268cd253b0587ff50c700000003515f4d05dbd8623b8652511e1eb38d38887a69eceb082f807514f09e127237c5213b401b9325b48c6c225968002318095f89d0ef9cf629b2b7f0172e03bc39aacf6ed800000007515f52414e474504b57a3805e41df328f5ca9aefa40fad5917391543b7b65c6476e60b8f72e9ad07c92f3b3e11c8feae96dedc4b14a6226ef3201244f37cfc1ee5b96781f48d2b000000075349474d415f3125001d1954a18571eaa007144c5a567bb0d2be4def08a8be918b8c05e3b27d312c59ed41e09e144eab5de77ca89a2fd783be702a47c951d3112e3de02ce6e47c000000075349474d415f3223994e6a23618e60fa01c449a7ab88378709197e186d48d604bfb6931ffb15ad11c5ec7a0700570f80088fd5198ab5d5c227f2ad2a455a6edeec024156bb7beb000000075349474d415f3300cda5845f23468a13275d18bddae27c6bb189cf9aa95b6a03a0cb6688c7e8d829639b45cf8607c525cc400b55ebf90205f2f378626dc3406cc59b2d1b474fba000000075349474d415f342d299e7928496ea2d37f10b43afd6a80c90a33b483090d18069ffa275eedb2fc2f82121e8de43dc036d99b478b6227ceef34248939987a19011f065d8b5cef5c0000000010000000000000000100000002000000030000000400000005000000060000000700000008000000090000000a0000000b0000000c0000000d0000000e0000000f"
}
],
"events": [],
"debug": {
"debugSymbols": [
"eJyrVsrJT04syczPK1ayqq6tBQAz9wY7",
"eJy9kkEKgzAQRe8ya5EkMxMTr1K6kNaCIFqqO8nda4uJRYPFCl0Z4c3Py08GqNtL0Vdt00E+AEJ+GqC7F83rr+uLRw+5SKBsruPXJXCr6hJy6ZIVJRHZTuS4NjLQSDGclCCPk9LfcNQq0IJm2LhzAvRH7ZEJImjNEW2OaSvrxVHipjqFAol1IPkdrY9Fs5ETqZE/oyNHDKEqs/MBeXcb2TFlTdorZ7xoA9NouBQcnqCwq0f1yxCn8eaNl0NcXhXH99keMftH7N4Rvb8A556tK0JN"
"eJzVkEEKgzAQRe8y6yAmkxkTr1K6kNaCIFqqO8nda4uJxQaLFQpdJYH3Py9/gLo9FX3VNh3kAyDkhwG6a9E8Xl1f3HrIUwFlcx5PJ+BS1SXk0ok3SiKSncjxbmSgUcdwrVLtca34A26RJtganFHjjgL0P0rTD6VHJkijNd9Lc0xaWa+NElfFdRhPEweSntXZvmoyciIZ6bU6skcoVZmdP0gbtzD7hFmzF85osQUn8aGNjyAu5+MkPuBqJP6F1YjdFnHuDt1ESYg="
],
"fileMap": {
"1": {
Expand All @@ -48,7 +48,7 @@
"path": "/mnt/user-data/kev/aztec-packages/yarn-project/aztec-nr/aztec/src/address.nr"
},
"38": {
"source": "use dep::std::hash::{pedersen_with_separator, sha256};\nuse crate::constants_gen::{\n GENERATOR_INDEX__SIGNATURE_PAYLOAD,\n GENERATOR_INDEX__L1_TO_L2_MESSAGE_SECRET,\n};\n\npub fn sha256_to_field<N>(bytes_to_hash: [u8; N]) -> Field {\n let sha256_hashed = sha256(bytes_to_hash);\n\n // Convert it to a field element\n let mut v = 1;\n let mut high = 0 as Field;\n let mut low = 0 as Field;\n\n for i in 0..16 {\n high = high + (sha256_hashed[15 - i] as Field) * v;\n low = low + (sha256_hashed[16 + 15 - i] as Field) * v;\n v = v * 256;\n }\n\n // Abuse that a % p + b % p = (a + b) % p and that low < p\n let hash_in_a_field = low + high * v;\n\n hash_in_a_field\n}\n\npub fn compute_secret_hash(secret: Field) -> Field {\n // TODO(#1205) This is probably not the right index to use\n pedersen_hash([secret], GENERATOR_INDEX__L1_TO_L2_MESSAGE_SECRET)\n}\n\n#[oracle(pedersenHash)]\nfn pedersen_hash_oracle<N>(_inputs: [Field; N], _hash_index: u32) -> Field {}\n\nunconstrained fn pedersen_hash_internal<N>(inputs: [Field; N], hash_index: u32) -> Field {\n pedersen_hash_oracle(inputs, hash_index)\n}\n\n// TODO(Kev): We can move this into the noir std-lib \n// as an acir opcode, once we have the pedersen PR merged.\npub fn pedersen_hash<N>(inputs: [Field; N], hash_index: u32) -> Field {\n // Temporary hack. This is not right. Kev forced me to do this. Blame him.\n pedersen_hash_internal(inputs, hash_index)\n // let input_size = inputs.len();\n // let mut modified_inputs = [];\n // modified_inputs = modified_inputs.push_back(input_size as Field);\n // for i in 0..N {\n // modified_inputs = modified_inputs.push_back(inputs[i]);\n // }\n // pedersen_with_separator(modified_inputs, hash_index)[0]\n}",
"source": "use dep::std::hash::{pedersen_hash_with_separator, sha256};\nuse crate::constants_gen::{\n GENERATOR_INDEX__SIGNATURE_PAYLOAD,\n GENERATOR_INDEX__L1_TO_L2_MESSAGE_SECRET,\n};\n\npub fn sha256_to_field<N>(bytes_to_hash: [u8; N]) -> Field {\n let sha256_hashed = sha256(bytes_to_hash);\n\n // Convert it to a field element\n let mut v = 1;\n let mut high = 0 as Field;\n let mut low = 0 as Field;\n\n for i in 0..16 {\n high = high + (sha256_hashed[15 - i] as Field) * v;\n low = low + (sha256_hashed[16 + 15 - i] as Field) * v;\n v = v * 256;\n }\n\n // Abuse that a % p + b % p = (a + b) % p and that low < p\n let hash_in_a_field = low + high * v;\n\n hash_in_a_field\n}\n\npub fn compute_secret_hash(secret: Field) -> Field {\n // TODO(#1205) This is probably not the right index to use\n pedersen_hash([secret], GENERATOR_INDEX__L1_TO_L2_MESSAGE_SECRET)\n}\n\npub fn pedersen_hash<N>(inputs: [Field; N], hash_index: u32) -> Field {\n pedersen_hash_with_separator(inputs, hash_index)\n}",
"path": "/mnt/user-data/kev/aztec-packages/yarn-project/aztec-nr/aztec/src/hash.nr"
},
"58": {
Expand Down
Loading

0 comments on commit 3a1b242

Please sign in to comment.