Encrypt a Message Using Matrixes





Introduction: Encrypt a Message Using Matrixes

Well, it seems that you can use matrices to encode a secret message. That is pretty self-explanatory, so I'll stop writing here and go on to step 1.

Oh, wait, I came back to the introduction. You don't need a graphing calculator, but if you just so happen to have a TI 84+, I have a program that may help you out.

Step 1: Letters to Numbers

Actually, two things happen in this step. First off, you need to find a message worthy of undergoing this encryption. This may be difficult if you are just here because you find secret codes awesome, but have no secrets.

Ok, now that you have your message, you need to convert it to numerical format. An underbar (_) is a space ( ).

0 = _
1 = A
2 = B
3 = C
4 = D
5 = E
6 = F
7 = G
8 = H
9 = I
10 =J
11 = K
12 = L
13 = M
14 = N
15 = O
16 = P
17 = Q
18 = R
19 = S
20 = T
21 = U
22 = V
23 = W
24 = X
25 = Y
26 = Z

For my message, I will use "send help".

So it would look like, SEND_HELP_

Notice the space on the end. This is because you must have an even number of characters, because of how the encryption works (in groups of two letters).

When the letters are changed to numbers, my message reads as:

But remember, we are doing this with matrixes and letters in groups of two, so it will be better if you write it in this format:
[19 5] [14 4] [0 8] [5 12] [16 0]

Step 2: The Key

We now need a four integer key. For example,
[4 3]
[5 -3]

I don't think you can use zeroes. Otherwise, you can use any integer, but the bigger the numbers, the harder it will be to multiply out by hand.

Step 3: Multiply

Now, you have to multiply. This involves math.

We have the message:
[19 5] [14 4] [0 8] [5 12] [16 0]

and the key:
[4 3]
[5 -3]

To make this easier to write, lets name our matrices.
We will call the key [K].
[19 5] can be [A1]
[14 4] can be [A2]
[0 8] can be [A3]
[5 12] can be [A4]
and [16 0] can be [A5]

We will call the results [B''n''], where n matches the [A''n''] matrices.

Now, we multiply like this:
[A''n''] * [K] = [B''n'']
[A1] * [K] = [B1]
[B1] = [101 42]

This is not the time to realize you don't know how to multiply matrices, as that is not what this instructable teaches. If you have no idea how I did what I just did, go learn how to multiply matrices, or get a graphing calculator (like the TI 84+). Remember, order is important here.

Once you multiply out you matrixes, you get the encoded results.
[B1] = [101 42]
[B2] = [76 30]
[B3] = [40 -24]
[B4] = [80 -21]
[B5] = [64 48]

The picture in this step demonstrates how matrix multiplication works.

Step 4: Rewrite

From the previous step, we got:
[B1] = [101 42]
[B2] = [76 30]
[B3] = [40 -24]
[B4] = [80 -21]
[B5] = [64 48]

You can rewrite this as:
101, 42, 76, 30, 40, -24, 80, -21, 64, 48

Now you have an encrypted message!

Step 5: Decryption

Recall that to encrypt your message, we used:
[A''n''] * [K] = [B''n'']

Well, to decrypt it, we use
[B''n''] * [K]-1 = [A''n'']

[K]-1 is the inverse of [K]. This Instructable doesn't teach you how to find the inverse of a matrix either. Google it or get a graphing calculator.

Step 6: TI 84+ Program

If you have a TI 84+ you could multiply the matrices with it, or you could use the nifty program I wrote to do it all for you.

I have uploaded the program in zip format.  It exceeded even my expectations!  You can quickly and easily encrypt and decrypt messages with any sized key.  Full documentation is included.

2 People Made This Project!


  • Paper Contest 2018

    Paper Contest 2018
  • Pocket-Sized Contest

    Pocket-Sized Contest
  • Science of Cooking

    Science of Cooking

We have a be nice policy.
Please be positive and constructive.




I can't open that document? How should I do this? .zip file?

Is your program compatible with a TI-83 Plus?

would it be possible to put the test of the program on instructables, so that it can be adapted to other calculators?

Great Instructable!!! I learned how to do this and math and thought this was pretty cool. :D

I made a program similar to this one. Only my program took a string of letters and changed it first into a list of numbers and then into a matrix of 0's and 1's I later made another program that does the same thing and then takes the matrix and reads it inverted, generates a string of numbers which were easier to send as a message and much more secure but much harder to decode without the program. If anyone wants, I may post an ible on this exact program and share the program as well.

Could you post the actual code for the TI program?

A graphing calculator.

If you have a TI 84, you could just use my program. It gets it.

If anyone is interested, I have just uploaded the TI 84 program.