【已无】完成基于内存的PoW证明,赢得8.88支付宝口令红包(doge

2026-04-11 15:301阅读0评论SEO基础
  • 内容介绍
  • 文章标签
  • 相关推荐
问题描述:

这次增加了公平性,为了避免选手使用高性能显卡跑Hash,本次游戏引入Argon2id算法(笑),采用基于内存的PoW证明,尽量拉低选手之间的硬件性能差距。

游戏说明:数字王国中,有一个可爱的魔法数字在数字广场和它的家人走散了,你作为王国的守护者,需要在广场众多的普通数字中找到那个魔法数字,让它和它的家人成功团聚。

游戏玩法:你需要在指定的范围内找到一个数字,将该数字与题目中的“字符串前缀”拼接在一起(字符串前缀+数字)组成一个新的字符串。将新的字符串进行UTF-8编码并使用Argon2id算法进行计算(请勿修改题目提供的Argon2id参数,否则会永远无法得到正确答案)。得到的32字节(256位)作为AES256 ECB的Secret对密文进行解密,如果得到的内容包含指定特征,则代表你找到了正确的Key并成功解密!

已公开出题代码:

import base64 import argon2 from Crypto.Cipher import AES from Crypto.Util.Padding import pad kdf_prefix = "LinuxDo" #KDF派生密钥前缀 plain_prefix = "恭喜!" #特征 plain_code = "" #口令红包口令,待定 plain_text = plain_prefix+plain_code argon2_salt=b"" #argon2算法盐值,待定 # Argon2id 参数 time_cost=2 #循环2次 memory_cost=65536 #64MB 内存块 parallelism=4 #四线程计算 nonce = 0 #待定 print("生成中...") nonce_text = str(nonce) text_to_hash = (kdf_prefix + nonce_text).encode('utf-8') aes_key_bytes = argon2.low_level.hash_secret_raw( secret=text_to_hash, salt=argon2_salt, time_cost=time_cost, memory_cost=memory_cost, parallelism=parallelism, hash_len=32, type=argon2.low_level.Type.ID ) cipher = AES.new(aes_key_bytes, AES.MODE_ECB) padded_plaintext = pad(plain_text.encode('utf-8'), AES.block_size) ciphertext_bytes = cipher.encrypt(padded_plaintext) ciphertext_base64 = base64.b64encode(ciphertext_bytes).decode('utf-8') print("\n生成完毕!") print(f"密文是: \n{ciphertext_base64}\n") print(f"参数公布:Argon2id, time_cost={time_cost}, memory_cost={memory_cost}, parallelism={parallelism}") print(f"盐值(Salt): {argon2_salt.decode()}, 密钥长度(hash_len): 32")

解密代码参考:

import base64 import argon2 from Crypto.Cipher import AES from Crypto.Util.Padding import unpad import time import random kdf_prefix = "LinuxDo" # KDF派生密钥前缀 plain_prefix = "恭喜!" # 特征 argon2_salt = b"" # 粘贴argon2算法盐值 ciphertext_base64 = "" # 粘贴密文 MAX_RANGE = 0 # 粘贴最大范围 # Argon2id 参数(请勿修改) time_cost = 2 # 循环2次 memory_cost = 65536 # 64MB 内存块 parallelism = 4 # 四线程计算 print("开始验证...") start_time = time.time() ciphertext_bytes = base64.b64decode(ciphertext_base64) tested_nonces = set() while True: if len(tested_nonces) > MAX_RANGE: print("卡池已抽干,未能找到正确钥匙!") # 按理说应该是不会哈 break nonce = random.randint(0, MAX_RANGE) if nonce in tested_nonces: continue tested_nonces.add(nonce) nonce_text = str(nonce) text_to_hash = (kdf_prefix + nonce_text).encode("utf-8") aes_key_bytes = argon2.low_level.hash_secret_raw( secret=text_to_hash, salt=argon2_salt, time_cost=time_cost, memory_cost=memory_cost, parallelism=parallelism, hash_len=32, type=argon2.low_level.Type.ID, ) try: cipher = AES.new(aes_key_bytes, AES.MODE_ECB) decrypted_padded = cipher.decrypt(ciphertext_bytes) decrypted_text = unpad(decrypted_padded, AES.block_size).decode("utf-8") if plain_prefix in decrypted_text: elapsed = time.time() - start_time print(f"\n🌟 欧皇附体!暴击通关!耗时 {elapsed:.2f} 秒") print(f"🌟 你一共抽了 {len(tested_nonces)} 次卡!") print(f"✅ 正确的nonce 是: {nonce_text}") print(f"🎉 明文是: \n{decrypted_text}") break except Exception: pass tries = len(tested_nonces) if tries > 0 and tries % 50 == 0: print(f"[*] 进度:已进行 {tries} 次抽卡...")

解密的参考代码中,引入了随机数,如果你的运气够欧的话,说不定0.1s就解出来了(doge

当然解密代码仅供参考,如果你有效率更高的方式(例如使用C/C++或者效率更高的Argon2id库)也可以使用哦

需要注意的是,“特征”字符串不是口令红包口令的一部分!

游戏参数:

KDF派生密钥前缀:LinuxDo
特征:恭喜!
数字范围:0-600000
密文:WFWcVFNvpi3R4quwB5tQP+8g1EQ2NL+VWbyg+h2VoRmnwEEeX5v8bq9Nyj9aYlfv
argon2算法盐值:KLC@Ah2Rm5KP455mb@Wq9LxK2exCwbfP
Argon2id循环次数:2
Argon2id内存消耗:64MB
线程:4

“Fairer. More fun. And all about luck.”

网友解答:
--【壹】--:

awa~


--【贰】--:

不要哇,我刚跑出来


--【叁】--:

哥,硬盘内存条多贵知道吗,这样跑,我心疼


--【肆】--:

有点烧cpu


--【伍】--:

pow不动了


--【陆】--:

不要哇,我还在跑


--【柒】--:

www!半夜不睡觉!


--【捌】--:

你说这次的简单,没那么大数,那我肯定跑啊,天天整那种万亿级别的枚举,这谁敢跑啊,新内存条跑一次都变十八手残次品了


--【玖】--:

awa(


--【拾】--:

就是要烧CPU才能拉低大家硬件性能差距,增加公平性


--【拾壹】--:

已领到,感谢佬友!


--【拾贰】--:

你不是不跑嘛


--【拾叁】--:

恭喜!!!

标签:纯水
问题描述:

这次增加了公平性,为了避免选手使用高性能显卡跑Hash,本次游戏引入Argon2id算法(笑),采用基于内存的PoW证明,尽量拉低选手之间的硬件性能差距。

游戏说明:数字王国中,有一个可爱的魔法数字在数字广场和它的家人走散了,你作为王国的守护者,需要在广场众多的普通数字中找到那个魔法数字,让它和它的家人成功团聚。

游戏玩法:你需要在指定的范围内找到一个数字,将该数字与题目中的“字符串前缀”拼接在一起(字符串前缀+数字)组成一个新的字符串。将新的字符串进行UTF-8编码并使用Argon2id算法进行计算(请勿修改题目提供的Argon2id参数,否则会永远无法得到正确答案)。得到的32字节(256位)作为AES256 ECB的Secret对密文进行解密,如果得到的内容包含指定特征,则代表你找到了正确的Key并成功解密!

已公开出题代码:

import base64 import argon2 from Crypto.Cipher import AES from Crypto.Util.Padding import pad kdf_prefix = "LinuxDo" #KDF派生密钥前缀 plain_prefix = "恭喜!" #特征 plain_code = "" #口令红包口令,待定 plain_text = plain_prefix+plain_code argon2_salt=b"" #argon2算法盐值,待定 # Argon2id 参数 time_cost=2 #循环2次 memory_cost=65536 #64MB 内存块 parallelism=4 #四线程计算 nonce = 0 #待定 print("生成中...") nonce_text = str(nonce) text_to_hash = (kdf_prefix + nonce_text).encode('utf-8') aes_key_bytes = argon2.low_level.hash_secret_raw( secret=text_to_hash, salt=argon2_salt, time_cost=time_cost, memory_cost=memory_cost, parallelism=parallelism, hash_len=32, type=argon2.low_level.Type.ID ) cipher = AES.new(aes_key_bytes, AES.MODE_ECB) padded_plaintext = pad(plain_text.encode('utf-8'), AES.block_size) ciphertext_bytes = cipher.encrypt(padded_plaintext) ciphertext_base64 = base64.b64encode(ciphertext_bytes).decode('utf-8') print("\n生成完毕!") print(f"密文是: \n{ciphertext_base64}\n") print(f"参数公布:Argon2id, time_cost={time_cost}, memory_cost={memory_cost}, parallelism={parallelism}") print(f"盐值(Salt): {argon2_salt.decode()}, 密钥长度(hash_len): 32")

解密代码参考:

import base64 import argon2 from Crypto.Cipher import AES from Crypto.Util.Padding import unpad import time import random kdf_prefix = "LinuxDo" # KDF派生密钥前缀 plain_prefix = "恭喜!" # 特征 argon2_salt = b"" # 粘贴argon2算法盐值 ciphertext_base64 = "" # 粘贴密文 MAX_RANGE = 0 # 粘贴最大范围 # Argon2id 参数(请勿修改) time_cost = 2 # 循环2次 memory_cost = 65536 # 64MB 内存块 parallelism = 4 # 四线程计算 print("开始验证...") start_time = time.time() ciphertext_bytes = base64.b64decode(ciphertext_base64) tested_nonces = set() while True: if len(tested_nonces) > MAX_RANGE: print("卡池已抽干,未能找到正确钥匙!") # 按理说应该是不会哈 break nonce = random.randint(0, MAX_RANGE) if nonce in tested_nonces: continue tested_nonces.add(nonce) nonce_text = str(nonce) text_to_hash = (kdf_prefix + nonce_text).encode("utf-8") aes_key_bytes = argon2.low_level.hash_secret_raw( secret=text_to_hash, salt=argon2_salt, time_cost=time_cost, memory_cost=memory_cost, parallelism=parallelism, hash_len=32, type=argon2.low_level.Type.ID, ) try: cipher = AES.new(aes_key_bytes, AES.MODE_ECB) decrypted_padded = cipher.decrypt(ciphertext_bytes) decrypted_text = unpad(decrypted_padded, AES.block_size).decode("utf-8") if plain_prefix in decrypted_text: elapsed = time.time() - start_time print(f"\n🌟 欧皇附体!暴击通关!耗时 {elapsed:.2f} 秒") print(f"🌟 你一共抽了 {len(tested_nonces)} 次卡!") print(f"✅ 正确的nonce 是: {nonce_text}") print(f"🎉 明文是: \n{decrypted_text}") break except Exception: pass tries = len(tested_nonces) if tries > 0 and tries % 50 == 0: print(f"[*] 进度:已进行 {tries} 次抽卡...")

解密的参考代码中,引入了随机数,如果你的运气够欧的话,说不定0.1s就解出来了(doge

当然解密代码仅供参考,如果你有效率更高的方式(例如使用C/C++或者效率更高的Argon2id库)也可以使用哦

需要注意的是,“特征”字符串不是口令红包口令的一部分!

游戏参数:

KDF派生密钥前缀:LinuxDo
特征:恭喜!
数字范围:0-600000
密文:WFWcVFNvpi3R4quwB5tQP+8g1EQ2NL+VWbyg+h2VoRmnwEEeX5v8bq9Nyj9aYlfv
argon2算法盐值:KLC@Ah2Rm5KP455mb@Wq9LxK2exCwbfP
Argon2id循环次数:2
Argon2id内存消耗:64MB
线程:4

“Fairer. More fun. And all about luck.”

网友解答:
--【壹】--:

awa~


--【贰】--:

不要哇,我刚跑出来


--【叁】--:

哥,硬盘内存条多贵知道吗,这样跑,我心疼


--【肆】--:

有点烧cpu


--【伍】--:

pow不动了


--【陆】--:

不要哇,我还在跑


--【柒】--:

www!半夜不睡觉!


--【捌】--:

你说这次的简单,没那么大数,那我肯定跑啊,天天整那种万亿级别的枚举,这谁敢跑啊,新内存条跑一次都变十八手残次品了


--【玖】--:

awa(


--【拾】--:

就是要烧CPU才能拉低大家硬件性能差距,增加公平性


--【拾壹】--:

已领到,感谢佬友!


--【拾贰】--:

你不是不跑嘛


--【拾叁】--:

恭喜!!!

标签:纯水