def bytes_to_long(s):
 acc = 0L
 unpack = struct.unpack
 length = len(s)
 if (length % 4):
  extra = (4 - (length % 4))
  s = ((b('\x00') * extra) + s)
  length = (length + extra)
 for i in range(0, length, 4):
  acc = ((acc << 32) + unpack('>I', s[i:(i + 4)])[0])
 return acc

def bytes_to_long ( s ) : acc = 0 L unpack = struct . unpack length = len ( s ) if ( length % 4 ) : extra = ( 4 - ( length % 4 ) ) s = ( ( b ( '\x00' ) * extra ) + s ) length = ( length + extra ) for i in range ( 0 , length , 4 ) : acc = ( ( acc << 32 ) + unpack ( '>I' , s [ i : ( i + 4 ) ] ) [ 0 ] ) return acc
bytes_to_long : long convert a byte string to a long integer .