# Revision history [back]

### How to convert an integer to fixed length binary string in Sage?

I want to get

(192,14,100)=>8bit binary of 192 || 8bit binary of 14 ||8bit binary of 100 => 110000000000111001100100 => 12586596 (equivalent decimal of the 24bits binary sting).


I have written python code to do this, but this code does not work in sage. Here is the code :

L=(192,14,100)
a=0
for i in range(3):
a=(a << 8) ^ (L[i])
print a
print bin(a)


What is the best way to do so in Sage?