This category tests your skills in fundamental areas for understanding modern cryptography. These include data encoding, the XOR operator, and basic modular arithmetic. You may know this stuff already, but you can still gain points and have fun completing these challenges!
ENCODING
ASCII
题目描述
python代码
1 2 3 4 5
arr=[99, 114, 121, 112, 116, 111, 123, 65, 83, 67, 73, 73, 95, 112, 114, 49, 110, 116, 52, 98, 108, 51, 125] flag='' for i in arr: flag+=chr(i) print(flag)
from Crypto.Util.number import bytes_to_long, long_to_bytes from utils import listener # this is cryptohack's server-side module and not part of python import base64 import codecs import random
FLAG = "crypto{????????????????????}" ENCODINGS = [ "base64", "hex", "rot13", "bigint", "utf-8", ] with open('/usr/share/dict/words') as f: WORDS = [line.strip().replace("'", "") for line in f.readlines()]
if encoding == "base64": encoded = base64.b64encode(self.challenge_words.encode()).decode() # wow so encode elif encoding == "hex": encoded = self.challenge_words.encode().hex() elif encoding == "rot13": encoded = codecs.encode(self.challenge_words, 'rot_13') elif encoding == "bigint": encoded = hex(bytes_to_long(self.challenge_words.encode())) elif encoding == "utf-8": encoded = [ord(b) for b in self.challenge_words]
return {"type": encoding, "encoded": encoded}
# # This challenge function is called on your input, which must be JSON # encoded # defchallenge(self, your_input): if self.stage == 0: return self.create_level() elif self.stage == 100: self.exit = True return {"flag": FLAG}
if self.challenge_words == your_input["decoded"]: return self.create_level()
from pwn import * # pip install pwntools import json import codecs from Crypto.Util.number import bytes_to_long, long_to_bytes #远程连接 r = remote('socket.cryptohack.org', 13377, level = 'debug') #接收信息 defjson_recv(): line = r.recvline() return json.loads(line.decode()) #发送信息 defjson_send(hsh): request = json.dumps(hsh).encode() r.sendline(request)
for i in range(100): received = json_recv() print('***************************************************************第',i+1,'次********************************')