import hmac
from hashlib import sha256

r = 12345
try:
    b = r.to_bytes(1337, 'big')
    print(f"Big endian: {b[:10]} ... {b[-10:]}")
    h = hmac.new(b, b"test", sha256).hexdigest()
    print(f"HMAC big: {h}")
except Exception as e:
    print(f"Big failed: {e}")

try:
    b = r.to_bytes(1337, 'little')
    print(f"Little endian: {b[:10]} ... {b[-10:]}")
    h = hmac.new(b, b"test", sha256).hexdigest()
    print(f"HMAC little: {h}")
except Exception as e:
    print(f"Little failed: {e}")
