Skip to content

Commit

Permalink
Example
Browse files Browse the repository at this point in the history
  • Loading branch information
Oppen committed Nov 21, 2023
1 parent adc5424 commit 9cfac8c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions crates/starknet-types-core/src/felt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ impl Felt {
pub fn from_bytes_be_slice(bytes: &[u8]) -> Self {
// NB: lambdaworks ignores the remaining bytes when len > 32, so we loop
// multiplying by BASE, effectively decomposing in base 2^256 to build
// digits with a length of 32 bytes.
// digits with a length of 32 bytes. This is analogous to splitting the
// number `xyz` as `x * 10^2 + y * 10^1 + z * 10^0`.
const BASE: Felt = Self(FieldElement::<Stark252PrimeField>::const_from_raw(
UnsignedInteger::from_limbs([
576413109808302096,
Expand Down Expand Up @@ -129,7 +130,8 @@ impl Felt {
pub fn from_bytes_le_slice(bytes: &[u8]) -> Self {
// NB: lambdaworks ignores the remaining bytes when len > 32, so we loop
// multiplying by BASE, effectively decomposing in base 2^256 to build
// digits with a length of 32 bytes.
// digits with a length of 32 bytes. This is analogous to splitting the
// number `xyz` as `x * 10^2 + y * 10^1 + z * 10^0`.
const BASE: Felt = Self(FieldElement::<Stark252PrimeField>::const_from_raw(
UnsignedInteger::from_limbs([
576413109808302096,
Expand Down

0 comments on commit 9cfac8c

Please sign in to comment.