Skip to content

Instantly share code, notes, and snippets.

@color-typea
Created June 27, 2023 11:42
Show Gist options
  • Save color-typea/b2438416f9aeac232b50a94a57d29e03 to your computer and use it in GitHub Desktop.
Save color-typea/b2438416f9aeac232b50a94a57d29e03 to your computer and use it in GitHub Desktop.
from hashlib import sha256
def to_hash_block(value: int) -> bytes:
return value.to_bytes(16 * 2, "little", signed=False)
hasher = sha256()
print(to_hash_block(1).hex())
print(to_hash_block(2).hex())
hasher.update(to_hash_block(1))
hasher.update(to_hash_block(2))
print(hasher.digest().hex())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment