While I was cycling home from school I was thinking about how md5 gets his strings coded. And what causes that the length is always the same. While I was thinking I thought of an own, completely numerical system. It works like this: All characters get a numerical value, 1 till 9 will be 100 till 900, a will be 110, A will be 120, á will be 111, etc.. The value of the chars will be put in an array, so for ‘aAá’ we’ll get 0 => 110, 1 => 120, 2 => 111. The values will be counted up, with this example we get 341. This value will be multiplied with the encoded number of chars, in this case three, so 300. 300*341=102300. Then we’ll count the zeros at the end, two here and multply the previous result with this number. 3*1023=3069. 3069 is the encoded string of aAá. I’m not an expert in decryption, so I don’t know if it’s hard to get the encoded value back with reverse engineering without too much pain. It can also be used to encrypt texts. Think of a password, and multiply the encoded password with the plain value of the char. If you have the password you can get the text back by dividing it with the encoded password.
Another two examples: ‘fcG1aZ’ f = 220, c = 150, G = 250, 1 = 100, a = 110, Z = 670 , so the total is 1500. There are six chars, so we multiply it with 600. 600*1500=900000. Now we get rid of those zeros at the end. 9*5 is 40. ‘fcG1Z’ f = 220, c = 150, G = 250, 1 = 100, Z = 670 , so the total is 1390. There are five chars, so we
multiply it with 500. 500*1390=695000. Now we get rid of those zeros at
the end. 695*3 is 2085.
You probably noticed that the first example has a much smaller result than the second. One letter added or removed can change the result in a huge way. This can be good, but also bad, since it gives reverse engineers an idea which chars are most used, the ones at the end of the alphabet or at the beginning. I am not very known with de/encryption, so I can’t predict this very good.
Another thing that might happen is that you’ll encode two different strings and get the same result. This is the greatest problem. I’ll demonstrate it with the second example:
Instead of 5 zero’s we think that there were nine zeros at the end. So: 40/9 = 5 5*10^9 = 5000000000 We assume there were five chars: 5000000/500=10000000 And this result can be 100000 ones, but also 50000 two’s, etc. But of course also combinations of chars are possible. Before we can say if this is a good method the probability of getting a double result should be calculated. I’ll do that next time 🙂