git @ Cat's Eye Technologies hatoucan / master tests / utilities / ha-bin-to-hex.py3
master

Tree @master (Download .tar.gz)

ha-bin-to-hex.py3 @masterraw · history · blame

#!/usr/bin/env python3

# SPDX-FileCopyrightText: Chris Pressey, the original author of this work, has dedicated it to the public domain.
# For more information, please refer to <https://unlicense.org/>
# SPDX-License-Identifier: Unlicense

# converts raw bytes on input to hex couples on input.

import sys

while True:
    byte = sys.stdin.buffer.read(1)
    if len(byte) < 1:
        sys.exit(0)
    sys.stdout.write('%02x' % ord(byte))