18 Nisan 2025 Cuma

Modular Multiplicative Inverse

Giriş
Açıklaması şöyle
1. M seçimi : Pick a modulus M, which should be one more than the maximum value the field can hold.
In this case, since the max is 255, we choose M = 256.
2. P seçimi : Pick a number P that’s coprime with M (i.e., they share no common factors except 1).
Let’s go with P = 9.
3. Q seçimi : Now, a number Q such that (P × Q) mod M = 1. Q = 57
Örnek
encoded_value = (original_value * P) % M
original_value = (encoded_value * Q) % M

195 değeri için
219= (195 * 9) % 256
195 = (219 * 57) % 256