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.



3Likes
LinkBack URL
About LinkBacks





so as to say that I don't think that a better system is needed, the system seems to me robust. And as far as I'm concerned and as you have confirmed I'm not the first to use it and many image formats use it.
Yeah shouldn't say impossible for sure, but I was just referring to my particular case where I think probabilities of this are veeery low, anyways nice to see some more complicated example code like this 