[Tutor] Bits operations

Guillermo Fernandez guillermo.fernandez@epfl.ch
Thu Jul 10 18:10:02 2003


Cheers,

I'm playing with crypto algorithms (I just get out of the exam and I'm 
kind of masochist ;-) and there's of course bit operations.

Here's my problems:
1- How much bits does an integer take? I would like to play with 32 bits 
words and I don't really know how to limit this and specially fix the 
size in python (they say an int is represented by a long with _at least_ 
32 bits...).
2- I've not seen any binary representation of integers (thus there exist 
octal and hexa...). It's easier to see something like 00101001B... does 
it exist?
3- I've seen some bit-sting operations. Is there an easy way of reading 
the value of a bit in python in a straightforward manner? (for example 
"the bit i of integer n has a value 1 or 0?").

Could you please point me to a source of information or give me some 
comments?

Thanks!!

Guille