<s> """<STR_LIT>""" <EOL> from __future__ import absolute_import , division <EOL> import binascii <EOL> import struct <EOL> def intFromBytes ( data , byteorder , signed = False ) : <EOL> """<STR_LIT>""" <EOL> assert byteorder == '<STR_LIT>' <EOL> assert not signed <EOL> if len ( data ) % <NUM_LIT:4> != <NUM_LIT:0> : <EOL> data = ( b'<STR_LIT:\x00>' * ( <NUM_LIT:4> - ( len ( data ) % <NUM_LIT:4> ) ) ) + data <EOL> result = <NUM_LIT:0> <EOL> while len ( data ) > <NUM_LIT:0> : <EOL> digit , = struct . unpack ( '<STR_LIT>' , data [ : <NUM_LIT:4> ] ) <EOL> result = ( result << <NUM_LIT:32> ) + digit <EOL> data = data [ <NUM_LIT:4> : ] <EOL> return result <EOL> def intToBytes ( integer , length = None ) : <EOL> """<STR_LIT>""" <EOL> hexString = '<STR_LIT>' % ( integer , ) <EOL> if length is None : <EOL> n = len ( hexString ) <EOL> else : <EOL> n = length * <NUM_LIT:2> <EOL> return binascii . unhexlify ( hexString . zfill ( n + ( n & <NUM_LIT:1> ) ) ) </s>
