I have developed an encryption algorithm. Now i want to check avalanche effect by making one bit change in plaintext and observing how many bits are changing in ciphertext. But my doubt is "what is one bit change in plaintext" say for e.g if plaintext P1= 11223344 then do we mean one bit change as P2= 11229344
1 Answer
No. You cannot use decimal numbers (or ASCII characters for that matter). You have to use binary. Your algorithm will be operating in binary as do digital computing devices. If you were to use ASCII chartacters as you have, you'd only be testing the printable range of byte values. You'd have huge gaps in the test inputs and no continuity. You might only test 50% of the possible range, depending on your interpretation of what a printable ASCII character is. If you've defined your P1 and P2 as integers, then the gap will be even bigger (= 10/256%) as you're now restricting yourself to integer parsable characters.
So in the Java language, P1=0b1110011 and therefore P2=0b1010011. You randomly flip them. In Java that's easy as you can use BigInteger for that and it handles arbitrarily sized integers and their random generation.
There's some more detail of the test procedure in this, this and this other answer. Good luck with your normal curve.
-
$\begingroup$ Shamelessly advertisement... :D you could also add this link: crypto.stackexchange.com/questions/40268/… $\endgroup$– BivDec 26, 2016 at 14:08