# What is the probability to crack this hash/equation?

So the plaintext is "hello" (example).

I change it to [8, 5, 11, 11, 15] (offset of each letter in the alphabet)

I multiply the matrix by itself [64, 25, 121, 121, 225]

Then I separate all of the numbers: [6,4,2,5,1,2,1,1,2,1,2,2,5]

And find the offset of the number in the alphabet (F,D,B,E,A,B,A,A,B,A,B,B,E)

It's more of a hash than a cryptography cipher though...

It's very weak. I do find many issues, I'd like to know how I can improve.

-
What use do you think this has? You encode $DB$ and $AH$ the same way, and $BC$ the same way as $G$, so you give yourself a decoding problem. Your "hash" is longer than the original message, so when would you use it? –  Douglas Zare Apr 7 '11 at 20:13

Just looking at the sequence [6,4,2,5,1,2,1,1,2,1,2,2,5] should give you some idea of how easy this is to crack. There are not that many perfect squares to choose from, so the algorithm is fairly easily reversed.

$n$ - $n^2$
1 - 1
2 - 4
3 - 9
4 - 16
5 - 25
6 - 36
7 - 49
8 - 64
9 - 81
10 - 100
11 - 121
12 - 144
13 - 169
14 - 196
15 - 225
16 - 256
17 - 289
18 - 324
19 - 361
20 - 400
21 - 441
22 - 484
23 - 529
24 - 576
25 - 625
26 - 676

Only one square starts with 6 - 4, so the first letter must be an 'h'. Two different squares start with 2 - 5, but the next digit is not a 6, so the next letter must be an 'e'. You can get enough letters by using this method that the rest of a message should be easily deciphered.

-

The method that you have described is reversible. The only complication is that when converting from the third matrix back to the second there are choices of how many digits to use for each entry. Assuming that your original message made sense in English or any other language, the message can be decoded using dictionaries.

-