Introduction: Encrypt a Message Using Matrixes

Picture of 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

Picture of 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:
19,5,14,4,0,8,5,12,16,0

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

Picture of 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

Picture of 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

Picture of 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

Picture of 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

Picture of 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.

Comments

marks399 made it! (author)2016-04-08

hey could anyone help me know what does this mean <55x> or <558>

lalalalalaa (author)2016-03-15

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

NerdAlert1101 made it! (author)2014-02-20

I enjoyed this, and since I'm into computers, learning matrix encryption will be a good thing to learn!

account3r2 (author)2012-05-08

Is your program compatible with a TI-83 Plus?

ubuntucuber (author)2010-10-22

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

ubuntucuber (author)ubuntucuber2011-08-16

I meant text

Scout Jinx (author)2011-06-25

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

ccrh2008 (author)2010-10-11

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.

Foaly7 (author)2010-09-07

Could you post the actual code for the TI program?

gonturan (author)2010-06-25

A graphing calculator.

gonturan (author)2010-06-23

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

gonturan (author)2010-06-23

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

nutsandbolts_64 (author)2010-05-21

It's just simply sophisticated?!?! I think I'll start something a bit less...

nutsandbolts_64 (author)2010-05-21

 I don't understand the formula?!?!

Foaly7 (author)2009-08-22

Can Somebody write a code for a batch file to encrypt like this?

gonturan (author)Foaly72009-08-26

I am not sure if that is possible. Even though batch and TI BASIC are very similar, TI BASIC has more math-related commands, making it very easy to multiply matrices from a program. Batch doesn't have that functionality.

blister75 (author)2009-07-22

I know a way with out if .. then statements.

gonturan (author)blister752009-08-26

I asked a friend at school, and he told me to use the sub( command. I have it fixed on my calculator, I just need to update the instructable.

tailboy (author)2009-06-16

i give up!

gonturan (author)tailboy2009-08-26

Do you want help?

tailboy (author)2009-06-16

whats a four integer key please explain

gonturan (author)tailboy2009-08-26

You just pick four numbers, for example 3, 4 -7 and 12. Try to avoid zeroes and ones.

tailboy (author)2009-06-15

that looks hard!

Arbitror (author)2009-04-19

Pretty good, but improve spelling. ****

gonturan (author)Arbitror2009-04-26

What did I spell wrong? I have looked, but can't find anything... I may have overlooked something, in fact I usually do.

Arbitror (author)gonturan2009-04-26

Nevermind, looks like you fixed it!

jdege (author)2009-04-14
gonturan (author)jdege2009-04-14

Oh, thanks. I didn't know that. Mine only uses groups of two letters. However, I could easily modify my program to allow for much larger groups of letters. But then you end up with a key that is longer than the message itself, which would kind of suck.

jdege (author)gonturan2009-04-14

If you're working with just the letters A-Z, you're working modulo 26. There are only 456,976 2x2 matrices, and a large proportion of them aren't invertible. That's a very small key space.

gonturan (author)jdege2009-04-15

Perhaps I will also publish a version of my program that is for a different dimensioned key. What do you suggest? 3X3? 4X4? Mabey even 5X5?

yourcat (author)2009-04-14

Good, but I am just here because you find secret codes awesome, but have no secrets.

inventivefiend (author)2009-04-14

Cool. I like.

About This Instructable

106,887views

32favorites

License:

Bio: My screen name is an allusion to something. Does anyone besides me know what the allusion is to? If you think you know, feel free ... More »
More by gonturan:Encrypt a message using matrixesHow to start command prompt (complete)
Add instructable to: