2
$\begingroup$

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

$\endgroup$
2
$\begingroup$

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.