git @ Cat's Eye Technologies Falderal / master script / fa-hex-to-bin
master

Tree @master (Download .tar.gz)

fa-hex-to-bin @masterraw · history · blame

#!/usr/bin/env python3

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

# 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

import sys

while True:
    hex = sys.stdin.read(2)
    if len(hex) < 2:
        sys.exit(0)
    sys.stdout.write(chr(int(hex, 16)))