题目
Paper-Scissors-Rock!
The rule is very simple. You win the paper-scissor-rock for 10 times, you get my flag!
一、分析
直接随机选择十个,提交,得到结果
发现给出的哈希序列长度是64位,所以猜测是使用sha-256加密,又因为所有的plaintext都是"随机数字+{“SCISSORS”,“PAPER”,“ROCK”} 三者中其中一个",所以使用穷举1-1000内的数字加随机石头剪刀布来检查是否有相同的序列
二、解密
import hashlib
target_hashes = [
"56f13494c33c0eba1bea86bffac93719a1e7ab6e2cdce614e381be2d57f93d8e",
"5d60a946ef6a17fc48bee9a57be8322d4422c1449a5e8c6518bcc8ba40f6a99e",
"aa5f041ed9ea766460984397a1f6524fcdd3d4ecbbeecd20de8942666732451a",
"42715f4fbb6227144061ddb122d37298a0011b2ee373b55c146855a648fcf3d0",
"44bc6aeb93f6c42768b19871a50adc4e22a72d6c5e6c8fa07775f9b4978817ea",
"8d8fd6588939683541c9d3de69e9fd13aed7e1851024efa3fdd434a6a43ba01b",
"a686fa8e97ac32f3de81119262c5cecd37a4fe79ac65d588fe3bd79e48484858",
"cadb8052d056c62800af6931ae3781ca1a6ab645e73c00525cb0cc63615ea76d",
"9f87f7dcdd11e75735993abddfac2c51ae11bdd94fe2c67db208f4e13b48a958",
"65d880f1371b034235ac5892a33712914a524628ecd62ec2c3a4de5440f4fb92",
]
add = ["SCISSORS", "PAPER", "ROCK"]
def sha256_hash(text):
return hashlib.sha256(text.encode()).hexdigest()
plaintexts = []
for i in target_hashes:
found = False
for num in range(1, 1000):
for suffix in add:
text = f"{num}{suffix}"
if sha256_hash(text) == i:
plaintexts.append(text)
found = True
break
if found:
break
print(plaintexts)
运行之后得到
结果
选择正确的选项,得到Flag