HashStateTrait

A trait for hash state accumulators.Provides methods to update a hash state with new values and finalize it into a hash result.

Fully qualified path: core::hash::HashStateTrait

pub trait HashStateTrait<S>

Trait functions

update

Updates the current hash state self with the given felt252 value and returns a new hash state. # Examples

use core::pedersen::PedersenTrait;
use core::hash::HashStateTrait;

let mut state = PedersenTrait::new(0);
state = state.update(1);

Fully qualified path: core::hash::HashStateTrait::update

fn update(self: S, value: felt252) -> S

finalize

Takes the current state self and returns the hash result. # Examples

use core::pedersen::PedersenTrait;
use core::hash::HashStateTrait;

let mut state = PedersenTrait::new(0);
let hash = state.finalize();

Fully qualified path: core::hash::HashStateTrait::finalize

fn finalize(self: S) -> felt252