Module utils

Source
Expand description

The module for cryptographic operations, including polynomial generation, evaluation, prime number generation, hashing, modular arithmetic, and Lagrange interpolation.

Structs§

Polynomial
Represents a polynomial with coefficients in BigUint. This struct is used for operations such as Shamir’s Secret Sharing.

Functions§

egcd
Extended Euclidean algorithm for computing the greatest common divisor (gcd) and Bezout coefficients.
gen_rand
Generates a random BigUint number within the range [1, modulus).
generate_prime
Generates a prime number of a specified bit size.
hash_data
Hashes input data using SHA-256.
lagrange_interpolation_zero
Performs Lagrange interpolation at zero for a given set of points modulo a given modulus.
mod_exp
Calculates the modular exponentiation of a base raised to an exponent modulo a modulus.
mod_inv
Computes the modular multiplicative inverse of a modulo m.