File: encoding.py

package info (click to toggle)
python-eth-utils 5.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 1,140 kB
  • sloc: python: 5,985; makefile: 238
file content (6 lines) | stat: -rw-r--r-- 199 bytes parent folder | download
1
2
3
4
5
6
def int_to_big_endian(value: int) -> bytes:
    return value.to_bytes((value.bit_length() + 7) // 8 or 1, "big")


def big_endian_to_int(value: bytes) -> int:
    return int.from_bytes(value, "big")