Matrix Encryption
The following encryption technique, most often used on computers, involves converting a message to numbers and manipulating these numbers using matrices. The encrypted message can be decrypted using the inverse of the matrix involved in encrypting the original message.
Encoder (E) = invertible matrix (i.e. matrix with an inverse)
(A matrix with no inverse has determinant = 0 and is called ‘singular’.)
Decoder (E⁻¹) = matrix’s inverse
Let M = message matrix
To produce the encrypted matrix (X), multiply M by the encoder.
E M = X
In order to multiply M by E, the number of columns in E must equal the number of rows in M.
If one knows X and E, and wants to find M, solve the above equation for M.
E⁻¹ x E x M = E⁻¹ x X
I x M = E⁻¹ x X
M = E⁻¹ X
Example
Message to encrypt: ‘I love a-rational-econ!’
Let spaces = 0, a=1, b=2, c=3 etc., hyphens = 27 and the exclamation mark = 28.
Encoder (E) = invertible matrix (i.e. matrix with an inverse)
(A matrix with no inverse has determinant = 0 and is called ‘singular’.)
Decoder (E⁻¹) = matrix’s inverse
Let M = message matrix
To produce the encrypted matrix (X), multiply M by the encoder.
E M = X
In order to multiply M by E, the number of columns in E must equal the number of rows in M.
If one knows X and E, and wants to find M, solve the above equation for M.
E⁻¹ x E x M = E⁻¹ x X
I x M = E⁻¹ x X
M = E⁻¹ X
Example
Message to encrypt: ‘I love a-rational-econ!’
Let spaces = 0, a=1, b=2, c=3 etc., hyphens = 27 and the exclamation mark = 28.
Message becomes:
9, 0, 12, 15, 22, 5, 0, 1, 27, 18, 1, 20, 9, 15, 14, 1, 12, 27, 5, 3, 15, 14, 28
Choose an encoder. Here, a 3 x 3 encoder is used, allowing 3 numbers to be encrypted at a time (the bigger the matrix, the more numbers that can be encrypted at once).
9, 0, 12, 15, 22, 5, 0, 1, 27, 18, 1, 20, 9, 15, 14, 1, 12, 27, 5, 3, 15, 14, 28
Choose an encoder. Here, a 3 x 3 encoder is used, allowing 3 numbers to be encrypted at a time (the bigger the matrix, the more numbers that can be encrypted at once).
Now put the numbers of the numbered message into 3 x 1 matrices and multiply each of them by E.
The number of characters (including spaces) in M is not divisible by 3, so a space (0) is used at the end to enable the multiplication without interfering with the message.
Notice that the same number in M can be encrypted as different numbers. This makes it harder for cryptanalysts to decrypt X, with techniques such as frequency analysis; a pattern is harder to find.
Encrypted message (X):
69, 90, 27, 40, 82, 133, 135, 163, 4, 118, 157, 58, 79, 177, 87, 136, 176, 51, 80, 103, 27, 5, 38, 127
Decoding X using M = E⁻¹ X:
Encrypted message (X):
69, 90, 27, 40, 82, 133, 135, 163, 4, 118, 157, 58, 79, 177, 87, 136, 176, 51, 80, 103, 27, 5, 38, 127
Decoding X using M = E⁻¹ X:
Put the numbers of the encrypted message (X) into 3 x 1 matrices (in the same way as those from the numbered message when encrypting) and multiply each of them by E⁻¹.
Notice that 9, 0, 12 are the first numbers of the numbered message and that if translated back into letters using the table above, ‘I l’ is produced, the first characters of the original message M. Try to finish off decrypting the message.
Suggested reading: The Code Book – Simon Singh
Suggested reading: The Code Book – Simon Singh
Daniel Edwards