pub fn mod_reduce_string(poly: &Polynomial, modulus: i64) -> Polynomial
The mod_reduce_string
function applies modular reduction to the coefficients of a polynomial while optionally filtering out zero coefficients.
This ensures the coefficients remain within the range defined by the modulus, preserving data integrity for string-based operations.
Description
Inputs:
poly
: A reference to the inputPolynomial
whose coefficients will be reduced and potentially filtered.modulus
: Ani64
value specifying the modulus for reduction.
Output:
A new Polynomial
object with coefficients reduced modulo the given value. Zero coefficients may be filtered out based on implementation.
Use Case: This function is useful in cryptographic workflows where strings are encoded as polynomials, ensuring the data fits within a finite field and remains concise.