Skip to content

Instantly share code, notes, and snippets.

@yasudacloud
Created July 8, 2025 15:05
Show Gist options
  • Select an option

  • Save yasudacloud/7b1ba297c0cb74dab3f38d31cfd3041c to your computer and use it in GitHub Desktop.

Select an option

Save yasudacloud/7b1ba297c0cb74dab3f38d31cfd3041c to your computer and use it in GitHub Desktop.
from cryptography.hazmat.primitives.ciphers.aead import AESCCM
payload = b'\x53' + b'\x00'
nonce = crypt_counter.to_bytes(8, byteorder='little') + b'\x00' + random_code
tag_length = 4
crypt_counter += 1
aesccm = AESCCM(token, tag_length=tag_length)
encrypted = aesccm.encrypt(nonce, payload, b'\x00')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment