Created
April 17, 2022 17:16
-
-
Save 0awawa0/4ffd28989646ea7b9b509bce1af4dcae to your computer and use it in GitHub Desktop.
This file contains 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
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