Linear Maps
When working modulo m it suffices to work with integers in the range 0,1,...,m−1.
Let f(x;m,a)=(ax)modm be the linear map x-> (ax)modm from Zm into itself.
Recall that a function f(x) is said to be linear if f(αx∗βy)=αf(x)+βf(y) for all α,β,x and y.
For example, for m=4 the linear map with a=2 (on the left) is not invertible, but the linear map with a=3 (on the right) is invertible.
0 -> 0
0 -> 0
1 -> 2
1 -> 3
2 -> 0
2 -> 2
3 -> 2
3 -> 1
Why are we interested in inverting the map? Because the map scambles the elements of Zm and we may be interested in unscrambling them (think in cryptographic terms).
So, what is the inverse map?
It turns out that the inverse map if it exists, is also linear.
More specifically, the inverse map of f(x,m,amodm) is f(x,m,a−1modm), where a−1modm is the modular inverse of amodm. Indeed, if y=f(x;m,a)=axmodm then x=a−1ymodm.
Since the modular inverse of a modulo m only exists when gcd(a,m)=1 the linear map is invertible if and only if gcd(a,m)=1.
Keep in mind that we wish to devise a way to encrypt information by providing public data to do so (in this case it would be m and a).
Alas, this way of scrambling information is very easy to unscramble, so useless from a cryptography point of view.
Modular multiplication scrambles the information but it is easy to undo if we know m and a. What about modular exponentiation?
A Failed Cryptosystem
The Merklw-Hellman knapsack cryptosystem keeps the following information secret:
a set W={w1,w2,...,wn} of n positive integers, such that wk is a super-increasing sequence. i.e: wk>∑i=1k−1wi for 2≤k≤n.
a modulus m such that m>∑i=1nwi
a scrambling integer a such that gcd(a,m)=1.
and publishes the following information: set W′={w1′,w2′,...,wn′}, where wi′=(awi)modm, for 1≤i≤n.
It is much better to publish a random permutation of W′. To send a message composed by the n bits αk,1≤k≤n, compute and send.
This is a hard knapsack problem (in this case a subset sum problem). To decipher transform it into a trivial knapsack problem by computing a−1Cmodm, which is equal to ∑k=1nakwk and so can be solved by a greedy algorithm.
Merkle-Hellman Knapsack Example
The following example shows the Merklw-Hellman cryptosystem in action.
Secret data: W={1,3,5,12,22,47},m=100 and a=13.
Public data: W′={13,39,65,56,86,11}.
Unencrypted message to be sent: A={0,0,1,1,0,1}
Encrypted message sent: C=0∗13+0∗39+1∗65+1∗56+0∗86+1∗11=132
To decrypt compute 132∗13−1mod100=32∗77mod100=64 and then reason as follows [greedy algorithm for the easy subset sum problem]:
47 must be used to form the sum because 64>47. Hence α6=1. The rest of the sum is 64−47=17.
22 cannot be used to form the sum because 17<22. Hence α5=0.
12 must be used to form the sum because 17>12. Hence α4=1. The rest of the sum is 17−12=5.
As so on. In this particular case, the next iteration finishes the deciphering process.
Last updated