Jump to content

Matrix encryption

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Mazin07 (talk | contribs) at 22:57, 6 December 2006 (rmv'd linkless template because it has been linked from couple places now). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

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:

  1. The size of each data matrix (see below)
  2. The encoding used on the data (such as ASCII)
  3. 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 MESSAGE
Ciphertext: 1 0 13 5 19 19 1 7 5

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

References