Skip to content

Commit

Permalink
make this less of a pain
Browse files Browse the repository at this point in the history
  • Loading branch information
zardus committed Sep 30, 2024
1 parent a7097ce commit d457871
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cryptography/rsa-sig/dispatcher
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

import sys

from base64 import b64encode
from base64 import b64encode, b64decode

n = int(open("/challenge/key-n").read(), 16)
d = int(open("/challenge/key-d").read(), 16)

command = sys.argv[1].strip("\0") if len(sys.argv) > 1 else "chill"
if command == "flag":
command = b64decode(sys.argv[1].strip("\0")) if len(sys.argv) > 1 else "chill"
if b"flag" in command:
print("No.")
sys.exit(1)

signature = pow(
int.from_bytes(command.encode('latin1'), "little"),
int.from_bytes(command, "little"),
d,
n
).to_bytes(256, "little")
Expand Down

0 comments on commit d457871

Please sign in to comment.