Skip to content

Instantly share code, notes, and snippets.

@SmaugPool
Created July 16, 2024 09:55
Show Gist options
  • Save SmaugPool/c6d0d3743175e88dde1a79ca1aae5fdb to your computer and use it in GitHub Desktop.
Save SmaugPool/c6d0d3743175e88dde1a79ca1aae5fdb to your computer and use it in GitHub Desktop.
CIP67 Label
#!/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