Life as an encryption-decryption cycle
Encryption is a concept as old as life itself. The sequence of proteins, the primary purveyors of function in life as we know it, is encrypted within nucleic acids. It is decrypted by this remarkable machine known as the ribosome along with tRNAs, whose origin lie close to the origin of life itself. The encryption itself is relatively simple with a 4 symbol nucleic acid alphabet encoding a (usually) 20 symbol protein alphabet. This is done by having three letter words in the nucleic acid alphabet specify 1 letter in the protein alphabet. Thus, with a four letter alphabet one has words with 3 letters in the nucleic acid alphabet to specific just 20 letters in the protein alphabet. Thus, this encoding system necessarily has degeneracy, meaning multiple 3-letter words in the nucleic acid alphabet encode the same letter in the protein alphabet, e.g. . In addition, some of these 3-letter nucleic acid words encode a stop of the protein-word, i.e. the end of the protein sequence: usually .
Encryption by humans
In terms of human language, encrypting messages is probably as old as human language itself. The rest of this note is about how one of the most important modern forms of human encryption and decryption is carried out. What we are going to talk about in here is nothing original or new. One can find accounts of it in books dealing with higher arithmetic (like I first did) or on the internet. However, when we first learned of it in our youth, at least in our circles, it was not very well-known. We were so charmed by it then that we eagerly demonstrated it to a friend and acquaintances who suffered the outpourings of our meditations. About 28 years since that time, a gentleman asked me why prime numbers had any value at all and I explained this encryption mechanism to him. Hence, I thought I would record it, as I often record private teaching devices I might have used. Again, I must reiterate, this is not an area of my expertise. I am simply recording the beautiful mathematical device it uses in simplified form and in lay language without much of the jargon specific to this subject.
Encryption, however complex, has depended on using some form of key. This key was quite literally like the “Rosetta Stone”, which had allowed the decoding of the old Egyptian writing. With complex encodings, if the key is lost then decoding of the encrypted message can be difficult. The Harappan script is one such example, which has no such Rosetta Stone, and it is likely that the language which it encoded is largely lost; hence, we cannot make sense of what is encoded in its strings of symbols. In any case, the idea of the key can be simply illustrated. Say we take the key to be , the language to be English, the script to be standard Roman and the basic numerical encoding to be of the form . Let us say we want to use our key to encode the message “kill tonight”. Then we first write the numerical equivalent of “kill tonight” without space between the words: 11 9 12 12 20 15 14 9 7 8 20. Then we multiply each letter by the key to get: 143 117 156 156 260 195 182 117 91 104 260. This is our encrypted message. Anyone with the key can decode this message by reversing the procedure i.e. by division. The general version of technique gūḍha-yojya in Hindu cryptographic tradition. Of course this is a simple encryption. In addition to anyone who gets the key by some means, it might also be broken quite easily by an amateur code-breaker.
One can also imagine a slightly more complex encryption such as this:
1) The message to be encrypted is the same: “kill tonight” written without spaces as “killtonight”.
2) We choose a keyword, let us say “mrtyu” and repeat it as many times as to cover the message to encode:
This latter word is the transformer.
3) We then convert “killtonight” to its direct numeric equivalent as described in the earlier example: 11 9 12 12 20 15 14 9 7 8 20. Likewise, we convert the transformer into its numeric equivalent: 13 18 20 25 21 13 18 20 25 21 13.
4) We then add the each number of the message to be encoded to the corresponding number in the transformer to get the coding: 24 27 32 37 41 28 32 29 32 29 33.
5) We then subtract 26 from all those numbers in this coding that are greater than 26. Thus we get: 24 1 6 11 15 2 6 3 6 3 7.
6) We then convert it back to letters to get our encrypted message: “xafkobfcfcg”.
This is a more serious encoding and would need more effort to break unless one gets hold of the keyword by some means. Then one can use the keyword to reverse the procedure and get the original message.
Diffie, Hellman and Merkle
While the above two examples differ considerably in their complexity and difficulty in terms of being broken by a code-breaker, they still share a common feature, namely symmetry: both the sender of the encrypted message and its intended receiver need to have same key and keyword. That they have to somehow share this secret is the primary problem of this form of encryption. If the key is intercepted while being shared then the interceptor can read all the messages between the sender and the intended receiver. This would mean that the key should be changed from time to time but multiple changes only mean multiple key transfers which could result in further susceptibility to interception. Further, if there are multiple people in the network of encrypted information sharing it might increase the vulnerability of the key to being intercepted or it would impose the problem of managing the sharing of a large number of distinct keys. This remained the situation from the beginning of human encryption until the mid-1970s when Diffie, Hellman and Merkle showed that in principle it was possible to use a mathematical trick for two or more communicating parties to arrive at a common encryption key without having to share it. Thus, the sender and the receiver need not transmit a shared secret key. All they have to do is to share a public key, which by itself does not reveal to the interceptor the secret key they use to encrypt or decrypt message. The secret key used for encryption is not transmitted but is independently derived on either side from the information shared by the interlocutors and an asymmetric private key that is never shared with anyone.
The basic idea of Diffie, Hellman and Merkle depends on an arithmetic concept known as the primitive root modulo of a prime number : for an integer if one obtains every integer from when one takes the modulo to of all , where , then is the primitive root modulo . As an example consider and , then we have:
Thus, we get all the numbers for the operation for . Hence, 2 is a primitive root modulo 11.
To use this to derive an encryption key, without directly transmitting it, the following operation is performed. Let us call the two men who wish to exchange encrypted messages as K and C.
1) First K and C share a public key in the form of prime number say and one of its primitive roots .
2) Then K selects a secret integer say and transmits , i.e. to C.
3) Likewise C selects a secret integer say and transmits , i.e. to K .
4) Thus, one notices that K and C have not exchanged the same information beyond the public key. However they can use the numbers they have exchanged for the following computation on either side: K computes , i.e. . Similarly, C computes , i.e. . Thus, now both K and C are in possession of a common key , which they can use for encryption by some means without ever having shared it directly. The logic behind this is simple: The computation they perform on their respective sides results in .
Now, a snoop (let us call him R) will be in possession of the public key and used by K and C. R will also be able to intercept the numbers and that K and C exchanged just as any worthy snoop would do. With these numbers would R be able to determine or , which is what he would need to get hold of the encryption key? Given the prime , can assume a value , one of which will or . In our example with it can assume a value 1..36. R will have to find out plugging in which in the operation would yield . That will be , which was secretly used by K. Likewise for . This problem is known as the discrete logarithm problem. In our example, since there are only 36 values to check, R could simply figure out or through brute force and nearly instantaneously on a modern computer. However, note the following: The sequence of is plotted in the first panel of Figure 1. In the second panel we plot where is a safe prime. Similarly, we also plot the sequences of one of their respective primitive roots raised to all modulo a Sophie Germain prime and modulo a Mersenne prime.
We observe that the sequences of for each of the primes has a great deal of irregularity and appears to be mostly random. Thus, there is no pattern to where the derived from a given might be found be found. This illustrates nature of the discrete logarithm problem: there is currently no effective method to solve it and it is not even known if any effective method can be devised in principle. As such, one essentially needs to search much of the space of for a prime to find a solution. Thus, rather than if one were to use an enormous prime then there is no effective method to solve the problem of finding , given in sufficient time. For example, 512 bit. i.e. 154..155 digit decimal base primes were widely used. However, it was recently shown that by precomputing and storing all for some widely reused primes (an expensive and time-consuming operation) encryption based on them might be compromised. It is also believed that given the resources of the 5-eyes mleccha-s together with the prathamonmatta-s, their praṇidhi-s have similarly broken through the even stronger commonly used 1024 bit i.e. 308..309 digit primes through expensive pre-computation.
Just for the feel of it here is a 155 digit number that is probably a prime just to give you a sense of how many values one would need to search to break encryption based on such a :
Rivest, Shamir and Adleman
In the year following Diffie and Hellman’s publication, Rivest, Shamir and Adleman published their asymmetric public private key system, which again uses a clever mathematical device. We outline below with a mock example the idea behind what is now famous as the RSA system:
1) As usual consider the two interlocutors K and C. One of them, say K, selects two primes and . In our mock example we shall take and . K multiplies the two to get .
2) K then calculates . He then chooses a number which is mutually prime with 1656, let us say . He then shares as the public key with C.
3) C can now use this information to encrypt a number (for example a key to be shared for future communication) and send it to K. For our example we will take . What C does is to compute and send to K. is the encrypted information sent by C to K
4) To decrypt , K has to do the following computation. He has to first find a number such that . This means we have to find some integer such that we get an integer solution . In our case K has to solve . Since 1656 ends in 6 if he multiplies it by 4 and adds 1 to the result he will get a number divisible by . Thus he gets .
5) Next K has to compute to decode the encrypted number C has sent him. In our example that will be . This looks like a daunting thing to do but it can be broken by the following trick. First one writes in terms of powers of 2:
Since modulo is multiplicative we then take modulo by parts:
Thus, at the end of this calculation, which can be easily achieved with a computer, K decodes the number C sent him without ever having exchanged a symmetric secret key. The reason this trick works is because of an arithmetic function discovered by Leonhard Euler known as Euler’s totient function and a theorem proved by him in that regard. Apparently, Rivest, the discoverer of the RSA method got the clue for this method of encryption while reading about modular arithmetic in a book. We will not attempt to go into the higher arithmetic concerning the proof of Euler regarding but merely demonstrate how it applies to the RSA encryption.
Euler’s is defined as the number of integers , which are relatively prime (coprime) with i.e. . Thus, . For a prime it is easy to see that the value of for every other number below it will be relatively prime to it by definition. Thus, . This is the number used in calculating the second number of the public key. Thus, from the above account one can see that the decoding calculation is essentially: . From step 4 of above we have . Therefore, the decoding operation is . By Euler’s theorem . Thus, our expression evaluates to .
Now, the snooper R would have in his possession the public key and would obtain by intercepting the exchange between C and K. Hence, to decode he would need to have . The only way he can get that is by factorizing to obtain and . In our example can be factorized by a modern computer in a jiffy. However, in practice and are chosen to be giant numbers like 155 digits each. For example here are two probable prime numbers of 155 digits each:
I can multiply them on any ordinary laptop nearly instantaneously to get a 309 digit behemoth:
However, if we were to give a behemoth number of that magnitude for factorization, without telling you how we generated it, then it would not be possible with the realm of our current computation to factorize it. When we last checked the biggest product of two primes which was factorized was a 232 digit number and it was no quick or easy task. Nobody in the public domain knows to date knows if there is any efficient algorithm to factorize big numbers or whether it is even possible to device one. It is on this premise the RSA encryption hangs. Finally, it should be noted that both DHM and RSA are not really efficient methods for direct encryption of a large amount of information. Instead they are used to encrypt a key which can then be used to encrypt the actual message.