From c5af9f6c3c3836282eddc6f3427115cc56ebade8 Mon Sep 17 00:00:00 2001 From: Mariano Nicolini Date: Tue, 26 Mar 2024 12:51:23 -0300 Subject: [PATCH] Test lambdaworks hash as a const --- crates/starknet-types-core/src/hash/pedersen.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/starknet-types-core/src/hash/pedersen.rs b/crates/starknet-types-core/src/hash/pedersen.rs index 752a086..8f15943 100644 --- a/crates/starknet-types-core/src/hash/pedersen.rs +++ b/crates/starknet-types-core/src/hash/pedersen.rs @@ -5,17 +5,17 @@ use lambdaworks_math::field::{ }; use super::traits::StarkHash; +const PEDERSEN_LAMBDAWORKS: lambdaworks_crypto::hash::pedersen::Pedersen = + PedersenLambdaworks::default(); -#[derive(Default)] -pub struct Pedersen(PedersenLambdaworks); +pub struct Pedersen; impl StarkHash for Pedersen { /// Computes the Pedersen hash of two Felts, as defined /// in fn hash(felt_0: &Felt, felt_1: &Felt) -> Felt { // let pedersen = PedersenLambdaworks::default(); - - let hash = Self.0.hash(&felt_0.0, &felt_1.0); + let hash = PEDERSEN_LAMBDAWORKS.hash(&felt_0.0, &felt_1.0); Felt(hash) }