pub fn fmul(a: Uint256, b: Uint256) -> Uint256 {
    //Convert to BigUint and perform multiplication to avoid overflow
    let prod = BigUint::from_bytes_le( &a.to_bytes_le() ) * BigUint::from_bytes_le( &b.to_bytes_le() );
    let val_bytes = prod.modpow( &BigUint::new(vec![1]), &BigUint::from_bytes_le( &get_k_modulus().to_bytes_le() ) ).to_bytes_le(); // (a * b) % K_MOD
    return Uint256::from_bytes_le(&val_bytes);
}
/* ---------------
    Operations within the finite field
    defined by modulo PRIME, where PRIME is a large prime number
  ---------------- */
Operations within the finite field
defined by modulo PRIME, where PRIME is a large prime number
Operations within the finite field defined by modulo PRIME where PRIME is a large prime number
pub fn fmul(a: Uint256, b: Uint256) -> Uint256 {
    //Convert to BigUint and perform multiplication to avoid overflow
    let prod = BigUint::from_bytes_le( &a.to_bytes_le() ) * BigUint::from_bytes_le( &b.to_bytes_le() );
    let val_bytes = prod.modpow( &BigUint::new(vec![1]), &BigUint::from_bytes_le( &get_k_modulus().to_bytes_le() ) ).to_bytes_le(); // (a * b) % K_MOD
    return Uint256::from_bytes_le(&val_bytes);
}
pub fn fmul ( a : Uint256 , b : Uint256 ) -> Uint256 { //Convert to BigUint and perform multiplication to avoid overflow let prod = BigUint :: from_bytes_le ( & a . to_bytes_le ( ) ) * BigUint :: from_bytes_le ( & b . to_bytes_le ( ) ) ; let val_bytes = prod . modpow ( & BigUint :: new ( vec ! [ 1 ] ) , & BigUint :: from_bytes_le ( & get_k_modulus ( ) . to_bytes_le ( ) ) ) . to_bytes_le ( ) ; // (a * b) % K_MOD return Uint256 :: from_bytes_le ( & val_bytes ) ; }
Operations within the finite field
defined by modulo PRIME, where PRIME is a large prime number
Operations within the finite field defined by modulo PRIME where PRIME is a large prime number
a
Uint256
b
Uint256
a
Uint256
b
Uint256