Maple handles strings as a type. There is two-way conversion of strings to lists of numbers (based on character ASCII codes):
Congruence-based cryptography treats these number lists as lists of numbers modulo for some suitably large modulus . One takes some large power of each number in a number list. Encryption is enabled when one finds a pair of these exponents for a given such that the operation of taking the -th power inverts the operation of taking the -th power.
For the modulus the pair is a pair of such exponents.
The 95 printable ASCII codes have values in the range from to (hexadecimal 20 - 7E). If one works with these as unencoded numeric values, one will then want any prime factor of to be larger than . Consider the case where is a prime . By Fermat's theorem for each , or for all . It follows that if and , then for all . In the case that is prime, one wants a pair such that . This makes it necessary that both be coprime to . For a given that is coprime to there is a unique such mod .
For example, with , one has . Then is coprime to .
Therefore, may be paired with when working mod .
This generalizes to the case where is the product of distinct primes . In this case a congruence mod is equivalent to simultaneous congruences modulo each of the primes . Thus, with if and , then for all . Thus, for a given that is coprime to one finds as the unique solution of the congruence .