Fileghost 0.0.1 Released. ¯\_(ツ)_/¯
github.com
github.com
Also, don't call it private key. That term is reserved for asymmetric encryption. This here is just a key.
for p = 0 to inputLen-1
Output[p] = Input[p] xor Key[p mod keyKen]
next
The modulo makes the key wrap around, so it doesn't matter how long or short it is compared to the input data.If you know the input must be a jpeg, you can look up the file structure, especially the header, so you already know what the first couple bytes of the decrypted file have to look like. Boom, you already know the first couple bytes of the key. And no matter whether you use your original method or the xor method, if you know the length of the key, for example 256, you can also immediately decrypt a few bytes every 256 bytes into the file. You can then work your way from there, using other properties of the file type you're trying to decrypt to.
If you know multiple files have been encrypted with the same key, it gets even easier as you can infer information across all those files.
The xor method would only be truly safe if your key is as long as the data to encrypt, never gets reused and was generated using a secure random number generator.
Big files make the attack even easier.
> It's just an experiment, I'll also put an encrypted file with a prize for whoever reveals the original file!
Good idea.
> how are you going to guess a sequence that can have 256! different combinations and can be encrypted with several different keys?
Because there are other attacks possible besides just brute force.