Matrix encryption
In cryptography, matrix encryption is a relatively simple method of using matrices to encrypt text or data. The main idea is to convert the text into numbers, arranged in multiple matrices. The data matrix is then multiplied with the key, another matrix. The encrypted data is the numbers of the matrices written out. Decryption is done by rearranging the numbers into matrices, and then multiplying by the inverse of the key matrix.
Security
In order to decrypt the data, the recipient must know:
- The size of each data matrix (see below)
- The encoding used on the data (such as ASCII)
- The key matrix
This makes decryption difficult when only the encrypted data is known. However, if the data is broken up into 4-letter blocks (for a 2x2 matrix), then the encryption will produce the same numbers for identical blocks of 4 characters. For example, ABCD ABCD will produce a repeated encrypted set of numbers, but ABCD EABC DEAB will not. Normally, the larger the blocks, the more secure encryption will be.
Example
The text must first be converted into numbers. Usually, this is either done with the numbers 1 through 26 for plain-text, with zero as a space, or with the ASCII numerical codes or similar encoding.
In this example, A = 1, B = 2, and so on.
Plaintext: A MSSAGE Ciphertext: 1 0 13 19 19 1 7 5 There is not supposed to be an 'E' between 'M' and 'S'!
We will use the following key matrix:
The cipher-text will be arranged into 2x2 matrices. Other matrix sizes will also work, such as 2x1. If the length of the data does not fit into matrices evenly, the end is usually padded with spaces. By multiplying the first cipher matrix with the key matrix, we get the encrypted matrix.
For the second half of the message, we have:
The encrypted message can be written out as 1 2 70 102 22 42 22 34.
To decrypt it, the numbers are rearranged the same way into matrices, and then multiplied by the inverse of the key matrix.
This produces the original: 1 0 13 19 19 1 7 5
See Also
References
External links
- Matrix Encryption Tool - Uses 2x1 cipher-text matrix and a 2x2 encryption matrix. Written in PHP