Skip to content
This repository has been archived by the owner on Apr 9, 2024. It is now read-only.

chore(acvm)!: update hash function dependencies #260

Merged
merged 1 commit into from
May 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions acvm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ num-traits.workspace = true
acir.workspace = true
stdlib.workspace = true

blake2 = "0.9.1"
sha2 = "0.9.3"
sha3 = "0.9.1"
blake2 = "0.10.6"
sha2 = "0.10.6"
sha3 = "0.10.6"
crc32fast = "1.3.2"
k256 = { version = "0.7.2", features = [
"ecdsa",
Expand Down
6 changes: 3 additions & 3 deletions acvm/src/pwg/hash.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use acir::{circuit::opcodes::BlackBoxFuncCall, native_types::Witness, FieldElement};
use blake2::{Blake2s, Digest};
use blake2::{Blake2s256, Digest};
use sha2::Sha256;
use sha3::Keccak256;
use std::collections::BTreeMap;
Expand All @@ -12,7 +12,7 @@ pub fn blake2s(
initial_witness: &mut BTreeMap<Witness, FieldElement>,
func_call: &BlackBoxFuncCall,
) -> Result<OpcodeResolution, OpcodeResolutionError> {
let hash = generic_hash_256::<Blake2s>(initial_witness, func_call)?;
let hash = generic_hash_256::<Blake2s256>(initial_witness, func_call)?;

for (output_witness, value) in func_call.outputs.iter().zip(hash.iter()) {
insert_value(
Expand Down Expand Up @@ -63,7 +63,7 @@ pub fn hash_to_field_128_security(
initial_witness: &mut BTreeMap<Witness, FieldElement>,
func_call: &BlackBoxFuncCall,
) -> Result<OpcodeResolution, OpcodeResolutionError> {
let hash = generic_hash_256::<Blake2s>(initial_witness, func_call)?;
let hash = generic_hash_256::<Blake2s256>(initial_witness, func_call)?;

let reduced_res = FieldElement::from_be_bytes_reduce(&hash);
insert_value(&func_call.outputs[0], reduced_res, initial_witness)?;
Expand Down