Skip to content

Instantly share code, notes, and snippets.

@0awawa0
Created April 17, 2022 17:16
Show Gist options
  • Save 0awawa0/4ffd28989646ea7b9b509bce1af4dcae to your computer and use it in GitHub Desktop.
Save 0awawa0/4ffd28989646ea7b9b509bce1af4dcae to your computer and use it in GitHub Desktop.
import json
from ptCrypt.Math.base import xor
message = b"\x00" * 16
payload1 = json.dumps({"action": "tag", "message": message.hex()})
print(payload1)
tag = input("tag >> ")
iv = bytes.fromhex(json.loads(tag)["iv"])
ct = bytes.fromhex(json.loads(tag)["ct"])
newMessage = b"\xaa" * 16
newIv = xor(newMessage, iv)
assert xor(newMessage, newIv) == iv
payload2 = json.dumps({"action": "verify", "message": newMessage.hex(), "tag": [newIv.hex(), ct.hex()]})
print(payload2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment