Raw binary string --> long integer?

ngps at my-dejanews.com ngps at my-dejanews.com
Wed Apr 21 02:30:50 EDT 1999


Hi,

I'm looking for a way to do the following in pure Python.

Given a binary string, e.g., '\003\004\005', convert the string into a long.
So the example should become (3<<8|4)<<8|5 == 110000010000000101 == 197,637.

The binary strings can be arbitrarily long. (Ok, up to about 256 bytes for an
RSA public key. ;-)

Hints appreciated. Cheers.

- PS

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




More information about the Python-list mailing list