Sunday, April 24, 2011

Cryptography With Matrices



The ciphers used in cryptograms were originally created for real encryption of military or personal secrets. The word cryptogram is derived from the Greek word Kryptos meaning hidden and Gramma meaning letter. The first use of the cryptogram for entertainment purposes occurred during the Middle Ages by monks who had spare time for intellectual games. The goal is to take a message and encrypt it into a string of numbers via matrix multiplication. The receiving party then has to take the string of numbers and decrypt it back to the original message.
How?
As an initial example, we shall use the following message:



"HI THERE BUDDY"

I- Alpha-Numeric Substitution
First, we must assign each letter a numeric equivalent. Here, we shall reserve the number 0 to represent a space and use the numbers 1 – 26 to represent the 26 letters. Rather than just making a direct substitution in order, we can permute the digits in some way.



For example:


II- Coding Matrix
Choose an invertible n x n matrix A, for some size n , which will be used to encrypt the message. For example:



III- Encrypting the Message
We first convert the message above into the numeric script, using the alpha-numeric Substitution set in Step I: (H = 7, I = 10, Blank = 0, etc).
HI THERE BUDDY is then 7 10 0 19 7 6 17 6 0 1 22 3 3 26
Then we convert this script into a m x n matrix (n columns because our A is n x n).
The number of rows m depends on the length of the message.

We fill out the last row with more 0's as necessary:



Now Let C be the encrypted code of the original message. C = B * A.





Finally, we convert matrix C into a string that becomes the following encrypted message:
–39 –36 –19 69 51 71 15 4 27 –102 –84 –64 –147 –124 –95

IV- Decrypting the message
The second party receives only the encrypted message above. However the receiver knows the alpha-numeric code (Step I) and the coding matrix A (Step II). Thus, the encrypted script is converted back into an m x n matrix C and then multiplied by the inverse of A (A-1) to undo the original matrix multiplication.
C = B * A, then B = C * A-1 .

The result matrix is then converted back to the alphabet.



************************************
For further explanation, and different examples, follow the link below:

http://docs.google.com/viewer?a=v&q=cache:WvLXDcuAVeUJ:guilford.rps205.com/departments/math/Links/Algebra%2520II%2520-%2520College%2520Alg/4.4%2520Cryptograms%2520Using%2520Inverse%2520Matrices%2520in%2520Real%2520Life.ppt+Using+matrices+in+real+life+situations&hl=en&gl=lb&pid=bl&srcid=ADGEEShGe_l27hVpKU9ZAe2Rzu-E0o7jFV92YM4J8MBy45fH-6CbGTMpVvuwwU8VjYjAG3E-UvF5tnEJcKSLufILXu6t7rU4q-fCaxbuEL-ZJBxqM3FkvzYxMA9mwWO4y1BaqSng-FIO&sig=AHIEtbT643q6cCFdi7WwYXBsTsQGJM7OaQ


**********************************
And now, here is my encrypted message for you all.
Decrypt it and comment on my post including what you figure it out to be:



144 124 118 -111 -100 -59 186 162 150 174 144 152 !!!






1 comment:

  1. Hello Mohammad,

    nice post! Most of the posts so far are wonderful indeed!!!!!!!

    Please can you add a Label to your post?

    Thanks! Zeina

    ReplyDelete