Quote Originally Posted by beta3designs View Post
Well, off course a better system is possible, but I think it's robust enough: the possibility of someone writing a phrase that starts with the magic key exists, but it is very low, even more if you think that this is a file format (the next line needn't be user input, in fact in my case it is numerical data), also the magic key is added just after the encryption is done... so I'm pretty sure that the possibility of the magic key being the same as the first encrypted blob is very very low. And much lower if you use a long magic key. So in my case, kryptkat, the possibility of that happening equals 0 because I choose the magic key and obviously if the next line is numerical data I wouldn't use much numbers in it. Also this possibility that you mention is what I wanted to solve adding the newline after the magickey but it can be accomplished just as it's been said checking for the length not the \n.
You can reduce that even further by deliberately breaking the rules of grammar and using statistically infrequent characters... Q} would be one example... In proper english spelling Q is always followed by a U... Most people don't use curly braces in normal text.