forked from starknet-io/types-rs
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: felt creation from bytes is infallible
Expose 4 ways to create a field element from arbitrary bytes: - `from_bytes_be`/`from_bytes_le`: take exactly 32 bytes and interpret them as a big/little endian number of 256 bits and then build a field element from it, modulo STARK prime (in whatever representation `Stark252PrimeField` uses, currently Montgomery); - `from_bytes_be_slice`/`from_bytes_le_slice`: take any number of bytes and interpret them as a big/little endian number modulo STARK prime by decomposing into 256 bits integers and multiplying by the appropriate factors.
- Loading branch information
Showing
1 changed file
with
132 additions
and
17 deletions.
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