Blowfish in Python?

Darrell darrell at dorb.com
Tue Feb 29 18:15:14 EST 2000


Looks like it's not a standard shift.

>From intobject.c

 if (b >= LONG_BIT) {
  if (a < 0)
   a = -1;
  else
   a = 0;
 }
 else {
  if (a < 0)
   a = ~( ~(unsigned long)a >> b );
  else
   a = (unsigned long)a >> b;
 }

--Darrell


"Markus Stenberg" <mstenber at cc.Helsinki.FI> wrote in message >
> Hmm.. As far as I'm concerned, shifts for example do screw up.
>
> i.e.
>
> 0xffffffff >> 30
>
> [64bit Python: 3]
> [32bit Python: -1]
>
> As far as I'm concerned, that should _not_ happen. Or maybe it's just me.
>






More information about the Python-list mailing list