2600 Magazine_ The Hacker Quarterly - Digital Edition - Summer 2011 - 2600 Magazine [22]
The next step involves actual encryption, since we have our algorithm and the variables we need to generate the message. Because it is impossible to multiply A by 5 (not counting hexadecimal), we need a substitution method for our letters in order to turn them into numbers. It can be as simple as A=1, B=2, C=3, and so on, but nonetheless this is important because the recipient of your encrypted message will need to know how to turn the decrypted numbers back into readable text.
The message we are going to encrypt will be just one word, "problem." After substituting each letter for its number according to the simple substitution method mentioned above, we get: p=16, r=18, o=15, b=02, l=12, e=05, m=13 (16, 18, 15, 02, 12, 05, 13). Now we will use the RSA algorithm to encrypt and decrypt each number, using our public and private keys that we just made. Remember, in practice you would use your counterpart's public key, not your own. And he or she would use their own private key to decrypt the cipher. To encrypt: Cipher = (Message)^e mod N. So we take the first number, 16, and raise it to the 5th power which is 1048576. Then we apply mod N to this result, which gives us 11: 1048576 mod 35 = 11. By doing the same operation for all six remaining numbers our Cipher = 11 23 15 32 17 10 13. And that's it - this is the encrypted message. To decrypt: Message = (Cipher)^d mod N. Decrypting with our private key transforms our ciphered message back into its original form, which then can be substituted into its readable format. (11)^29 mod 35 = 16, 16=p.
Ideally, for this kind of fast and quick encryption method, announcing or publishing your public key in some wide open area is not recommended. At least not in the way conventional public keys are implemented or intended to be used. Instead, including them in your cipher is much more effective for our purpose. This eliminates others (who might know a thing or two about ciphers) from easily cracking your cipher through factoring out your modulus, which would be extremely easy given such small numbers. A way to do this is by including your public key at the end or beginning of each cipher, or just your first one to make it known to the recipient(s). Many other ways exist, but this is just one method to get the ball rolling.
In summary, remember to ensure that your p and q are prime and that your k factors out to two different numbers. Break your message into chunks so that the message length is shorter than your modulus. Also, remember ((e)(d) mod r) must equal 1, otherwise the cipher will not work.
A special thanks to l0j1k for giving me the idea and encouraging me to write this article.
* * *
Booze, Nosiness, and City Terminals
by th3linguist - th3linguist@googlemail.com | 847 words
0x00: Mother Tongue
English is not my mother tongue. So if you stumble across strange formulations, have a laugh or figure out which language is my mother tongue. If you are right, maybe I will send you a prize.
0x01: Preamble
Do you know this situation: You walk through a park or a city in the midday sun, with swollen eyes from last night’s boozing. Birds are singing, head is ringing, and passing cars are honking - and you swear to yourself: Never again will booze touch my throat! Never! Ever! Again! OK, so far, so familiar, and a few weeks ago that was th3linguist's status - and because of that he had a collision with a city terminal.
So, let me explain what a city terminal is. I live in a district town in the south of Germany (hint!). We have a palace there and a nice pedestrian area with a lot of shop windows and flower tubs. In 2005 the city council decided to do something for the tourists and assigned an IT company to install four information terminals in the city. The first generation consisted of a desktop PC, built into a control box with three displays on top of it for ads and another