Created
July 16, 2024 09:55
-
-
Save SmaugPool/c6d0d3743175e88dde1a79ca1aae5fdb to your computer and use it in GitHub Desktop.
CIP67 Label
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import sys, crc8, bitstring | |
label = int(sys.argv[1]) | |
hash = crc8.crc8(label.to_bytes(2, 'big')) | |
prefix = bitstring.pack('uint:4, uint:16, bytes:1, uint:4', 0, label, hash.digest(), 0) | |
print(f"{label}: {prefix.tobytes().hex()}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment