0

I'm trying to create a 16 bytes string on the wire in Big-Endian format. As you can see I'm ending-up with Little-Endian; where prepended 0's are at the end.

>>> import struct
>>> auth = "{0:<16}".format(1437722681) 
>>> authenticator = struct.pack("16s",bytes(auth,"utf-8")) 
>>> print (authenticator)
b'1437722681      '

I would like to create a code where I can have prepended values at the beginning, something like below:

>>> print (authenticator)
b'      1437722681'
  • What language or environment are you using? The way this would be done in Java is not portable to all other languages. – scottb Jul 26 '15 at 07:38
  • I'm using Python3. Code excerpts are from python interpreter –  Jul 26 '15 at 07:56

1 Answers1

0

it seems that change of the following line did the trick.

"{0:>16}.format(...)