pub fn encode_string(plaintext: &str, scaling_factor: f64) -> Polynomial
The encode_string
function converts a textual string into a polynomial representation.
Each character is transformed into its ASCII/Unicode value, scaled by a specified factor, and represented as a polynomial coefficient.
Description
Inputs:
plaintext
: A string slice (&str
) representing the text to be encoded.scaling_factor
: A positive scaling factor used to amplify the encoded values for precision and cryptographic operations.
Output:
A Polynomial
object containing integer coefficients, where each coefficient corresponds to a scaled character value from the input string.
Use Case: This function is utilized in cryptographic workflows to securely encode strings for polynomial-based encryption schemes.