The Use of Linear Algebra and Modular Arithmetic in Data Cryptography Zack Stica Modular arithmetic was discovered by K.F. Gauss in 1801. Two numbers are equal modulo n if their difference is exactly divisible by n. Modular addition and modular multiplication are both commutative, and can be used to create a cryptography system. [1] First, each character in the message to be encoded is assigned a number. For n characters, arithmetic modulo n will be used, and they will be assigned numbers 0 through n-1. In this example, the characters used will be every letter in the alphabet as well as _ which will be assigned numbers as follows: A 9 B 10 S 0 T 1 C 11 U 2 D 12 V 3 W 4 E 13 F 14 G 15 X 5 Y 6 Z 7 H 16 I 17 J 18 K 19 L 20 M 21 N 22 O 23 P 24 Q 25 R 26 _ 8 One way to encode a message is simply to add or subtract a constant from the character’s original number and convert it back into a letter again. However, this code would be easy to crack because every original letter that was the same would have the same encoded letter. Another way to encode would be to multiply the character’s original number by a constant. This code would be more difficult to break, but every original letter that is the same still has the same encoded letter. A more complex way of encoding information is to use matrix multiplication [2]. First, an enciphering matrix is created as follows: 5 1 1 A 3 2 4 2 1 2 The phrase to be encoded will be GOOD_DOGS. The enciphering matrix is a 3x3 matrix so the phrase will be divided into groups of 3 characters as follows: GOO D_D OGS. The corresponding numbers of these letters will be put into column matrices. G O O 15 23 23 D _ D 12 8 12 O G S 23 15 0 Then the enciphering matrix will be multiplied by these 3x1 column matrices. 5 1 1 15 121 3 2 4 23 183 2 1 2 23 99 5 1 1 12 80 3 2 4 8 100 2 1 2 12 56 5 1 1 23 130 3 2 4 15 99 2 1 2 0 61 Arithmetic modulo 27 will be performed on the result. 121 4( 27) 13 183 6( 27) 21 99 3( 27) 18 80 2( 27) 26 100 3( 27) 19 56 2( 27) 2 130 4( 27) 22 99 3( 27) 18 61 2( 27) 7 The corresponding letter will replace the number. 13 21 18 E M J 26 19 2 R K U 22 18 7 N J Z Finally these groups of three letters are combined to form the encrypted message EMJRKUNJZ. It can be noted that the same letters in the original message are different in the encrypted message, making the code very difficult to crack. Decoding a message is a simple task as long as the enciphering matrix is known [2]. The message PVNRRFTV will be decoded using the same numbering system as before and the enciphering matrix: 1 2 A 2 1 2 1 2 3 0 1 0 5 0 0 4 1 First A-1 must be calculated. A 1 15 13 6 9 10 13 20 4 5 8 6 7 11 9 11 17 Next A-1 is multiplied by the 4x1 matrices with entries corresponding to the letters of the message. 15 13 6 9 10 13 20 9 11 17 3 4 5 8 22 6 7 11 26 24 96 85 34 66 15 13 6 9 10 13 20 26 9 11 17 14 4 5 8 1 6 7 11 3 203 172 81 124 Arithmetic modulo 27 will be performed on the result. 96 3( 27) 85 4( 27) 34 2( 27) 66 2( 27) 15 23 20 12 203 7( 27) 172 7( 27) 81 3( 27) 124 4( 27) 14 17 0 16 The corresponding letter will replace these numbers. 14 17 0 16 G O L D 15 23 20 12 F I S H Finally these letters are combined to reveal the encrypted message GOLDFISH. While modular addition and multiplication can create an encoding method, it remains fairly easy to crack, but when modular arithmetic is combined with matrix multiplication it creates a difficult code to crack, unless the enciphering matrix is known. Thus it can be seen that modular arithmetic and matrix multiplication can be combined to form a powerful cryptography system. References: 1. Modular Arithmetic. www.cut-the-knot.org/blue/Modulo.shtml 2. Simple Encoding. www.mathcs.emory.edu/~rudolf/math108/summ1-2-3/node36.html