Files
sourcehub/.venv/Lib/site-packages/authlib/jose/rfc7518/util.py
T
2026-09-14 23:22:10 +09:00

13 lines
262 B
Python

import binascii
def encode_int(num, bits):
length = ((bits + 7) // 8) * 2
padded_hex = f"{num:0{length}x}"
big_endian = binascii.a2b_hex(padded_hex.encode("ascii"))
return big_endian
def decode_int(b):
return int(binascii.b2a_hex(b), 16)