Second Encryption Formula in Design Philosophy
|
|
I have came up with another simple formula, that allows 65535 possible combinations to decrypt it, while not bloating the string 1 bit.
proc Encrypt(string,key,inc) ASSERT(isnum(key) && isnum(inc)) for(var/i = 1 to length(string)) var/char = text2ascii(string,i)) key += inc while(key > 255) key -= 255 char ^= key . += char
|
So it allows 255 possible keys that can be incremented bh 255 different values allowing 65535 combinations. I think this is pretty good since it doesent increase the length of the string and is pretty difficult to crack.
|
EDIT: Not to mention that you could probably brute-force it in Not Much Time.
(Also, you can use % instead of the if(>=) -=255 thing.)