New answers tagged

0

You want to work modulo $2^{32}$, except for shift counts where that should be modulo $32$. The following is generic and works in Python. code (result in z) operation z = (x+y)&0xffffffff 32-bit addition of x and y z = (x-y)&0xffffffff 32-bit subtraction x minus y z = (x*y)&0xffffffff 32-bit multiplication of x and y z = ((x<<(31&y)...


1

This will depend on the language that you implement in. Java and other C-like languages have a built-in data type to represent unsigned 32-bit integers (this is why RC6 chose to use this form of arithmetic, so that its implementation in these languages is relatively straightforward). In such cases +, -, and * all automatically work mod $2^{32}$. If you're ...


3

The question's code computes the 64-bit get<2>(I)=$h:=f\,g\bmod n$ from inputs: 64-bit modulus_value=$n$ with $n\in[2,\,2^{63}]$ 64-bit get<0>(I)=$f$ with $f\in[0,\,2^{64}-1]$ 64-bit get<1>(I)=$g$ with $g\in[0,\,2^{64}-1]$ and $f\,g<2^{64}\,n$, a condition that's met if $f,g\in[0,\,n-1]$ (which I guess is always the case in the ...


Top 50 recent answers are included