I want to estimate when and wether different types of functions provide full or partial diffusion.
I'm trying to understand diffusion of basic operations, like:
- addtion,
- multiplication,
- xoring.
If we change one bit in $a$ how many bits will be changed in average in result $c$ if we do:
$a+b \mod n = c$
If we change one bit in $a$ how many bits will be changed in average in result $c$ if we do:
$a \oplus b \mod n = c$
If we change one bit in $a$ how many bits will be changed in average in result $c$ if we do:
$a \cdot b \mod n = c$
And what if we change one bit in $a$ how many bits will be changed in average in result $c$ if we do:
$(a >> 1) \cdot b \mod n = c$
Is it fairly easy to deduce or do I have to write a program to check it?
In xor case only one bit would be changed if we compute it for $a$ differing by one bit. But what with other cases? I think in case of $a >> 1$ nearly half of the bits will be changed, because if we switch two bits that way, we have about 50% probability that they would be the same or not. So simple $a >> 1$ could provide good diffusion (if we combine it with other mixing operations, just repeating this operation over and over, of course, makes no sense).
EDIT:
Let's consider $n$ equal to power of $2$.