I asked this on stack exchange with it being code based, but someone suggested to ask here.
Basically, I've done a script in python and wanted an option to encrypt the input, but I couldn't get any libraries working so I decided to try make my own, despite not knowing how actual encryption works. The result I think still needs a few tweaks, but I don't understand how it could be cracked.
I know the random feature of python is apparently very bad for encryption, but I'm using other things too, so you can't just fake an md5, you also need the exact same results from looping through each letter in the key.
I'll break it down into stages as to what it does:
Get md5 of the key and set that as the seed (it could be more complicated than an md5 but I don't think it'd make much difference
Loop through the key one letter at a time, and for each letter, crc32 it, and select one random digit from the result. Repeat this until you have x numbers (currently set to 128), and then shuffle the list.
Based on the size of the key, calculate how many extra characters to add for each character in the input. For all characters, generate another number between 0 and 255 to add to it.
Step 4 (reverse all this to decode):
Loop through the input one letter at a time, convert the character to a number, and add on the results from step 2 and 3, before converting back to a new character (making sure it is in the range of 0 to 255). The result is then all of these characters together, and can be reversed if the right key is given.
So, here's what the output is like:
key = "super secret key" input = "Test!" (encode) Result: hxrBVvYX27YlyKWKMxrA key = "super secret key" encodedstring = "hxrBVvYX27YlyKWKMxrA" (decode) Result: Test! key = "Super secret key" (decode) Result: ýO¼É
As you can see, the result is dramatically different when a lowercase letter is swapped for a capital, but it still comes out with something. In what way is this really insecure? The only way I'd know how to break it is by just trying millions of combinations until it finds an output word that's in the dictionary.
Also, as an example of it in use, I got it running here: http://goo.gl/VBRYpf
Hit the execute button, click in the green box, and follow the instructions :)
Apologies if it's not a suitable question for the website anyways, I'm not sure if I worded it a bit too specifically for my case