update_with method to hash states, allowing you to directly hash values of
any type T that implements Hash, rather than having to manually convert values to felt252
first. This provides a more ergonomic API when working with complex types.
update_with method to hash states, allowing you to directly hash values of
any type T that implements Hash, rather than having to manually convert values to felt252
first. This provides a more ergonomic API when working with complex types.
pub trait HashStateExTrait
fn update_with(self: S, value: T) -> S
use core::pedersen::PedersenTrait;
use core::hash::HashStateExTrait;
#[derive(Copy, Drop, Hash)]
struct Point { x: u32, y: u32 }
let point = Point { x: 1, y: 2 };
let hash = PedersenTrait::new(0)
.update_with(point)
.update_with(42)
.finalize();
Was this page helpful?