long long time ago I made my last post, but now I’m back with a simple series about a little self-made Crypto (Nah, it’s more a key generation), which uses a (At least I think it is ) new idea for key crafting. Either you’re now thinking “Oh, cool! Let’s see what his idea is” or you’re thinking “Self-made Crypto?!? Dude, WTF’s wrong with you?”, I hope anyway you’re liking this article, even if it’s just entertaining ;).
Am I an Idiot?
That’s a great question! Nope, I think I’m not (Okay, maybe… But that’s not the point here ;)). Of course I don’t want to create an EES (Extreme Encryption Standard), but just want to try out my idea, which I had already about half a year ago.
This series can be seen as a little hobby project, which I want to share with you, and not as a serious attempt to create a good Crypto. So with this in our mind, let’s start!
Introduction to my Idea
Maybe some of you know one problem of synchronous ciphers: You want to have long keys for a good encryption, but the key has to be sent to the decrypter, so it shouldn’t be too long. To solve this problem I stumbled upon a way of generating never ending keys out of a normal number.
Yes, it isn’t magic. It isn’t even pretty clever. I just thought of using a number to get it’s square root, because this is as long as you can calculate it. The first thing we have to check of course, if we want to know whether this way looks promising, is to have a look at the frequencies of the numbers 0-9 in different square roots.
With this in mind I wrote a simple program in C# to test for different frequencies in numbers. The big problem was that the double type in C# for representing decimals can only have about 17 digits after the floating point; but my original idea was to use up to 10000 digits for the key!
Ok, so I decided to just test these 17 digits for their frequencies first and then maybe think of an idea to expand it.
This tool is a simple Windows Forms Application, which takes a starting number and then calculates the square root of it. After it has done this it increases the number and calculates the next square root. The frequencies of the digits are shown with the number and percentage of their occurence.
You can get the project here. Little Note: I’m very sorry for the poor programming style. I can’t concentrate when it’s that hot
If you’re only interested in the executable you can get it here
If you run it you should see something like this:
You can start with a different number, but you’ll get the pretty same results. At this point I add an important fact: My program ignores any digits in front of the floating point! This is important to make sure that not everytime a 1 is added to the frequency just because the program is currently at the 1 billions. I tried that before and it changed the frequencies a lot!
Anyway, I was very surprised, when I saw this results! It’s very promising that every digit, except the Zero, has the pretty same frequency as every other digit. Another interesting thing is that this behaviour begins pretty fast.
Above you can see what happens if we stop the procedure at the very beginning. The frequencies aren’t that different!
Here you come into play! I thought it could be interesting, if you guys start to share your thoughts on this project and how it could get better.
How can we get longer keys (Currently only 17 digits can be used)
I would just use these 17 digits of the number and then increase it by one, to use the next square root and so on, till you got the key length you need. Here comes a little problem:
The frequencies aren’t perfectly spread
When you just need a small key, that’s right. This key generation can’t be used for small texts, but I think when you need more than 1.000.000 digits it’s good enough.
Improve probability spreading
This part is interesting. I thought of maybe putting always two digits into a group to mask the frequencies better, e.g. if you have this: 067453 you put it into this: 06 74 53. This should help a bit. (Not tested yet, though!)
What encryption can be used along this key generation?
Yep, here ends my knowledge . Maybe some of you have an idea which encryption technique would get along with a key like this one?
And it has to get practiced
As you see I didn’t test much about the frequencies in different states. I think it depends heavily on the encryption technique whether this key generation could be valuable or not. As I said before, I don’t have the knowledge/experience to select a good technique, so here it’s up to you ;).
This key generation could be usefull for generating large keys out of just a simple number or word (Words can be converted into numbers). The big big advantage would be that you would have an infinite amount of numbers, so you got as much keys as you want! These can be used to generate OTPs (One time pads; yes, this aren’t real OTPs, but they’re pretty close ;)), which are the optimal way of encrypting.
I hope maybe some of you got interested in this project as well and are keen on making cryptography great again! (Sorry, forgive me that bad joke )