-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
07bf1af
commit 6ff27b3
Showing
3 changed files
with
31 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ mod math; | |
mod array_print; | ||
mod array_extend; | ||
mod consts; | ||
mod hash; | ||
|
||
#[cfg(test)] | ||
mod tests; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
use pedersen::PedersenTrait; | ||
use hash::HashStateTrait; | ||
|
||
fn hash_felts(s: Span<felt252>) -> felt252 { | ||
let mut hash_state = PedersenTrait::new(0); | ||
let mut i = 0; | ||
|
||
loop { | ||
if i == s.len() { | ||
break hash_state.finalize(); | ||
} | ||
|
||
hash_state.update(*s.at(i)); | ||
} | ||
} |