首页
社区
课程
招聘
[原创]第二题 子鼠开天
发表于: 2020-4-16 17:06 2790

[原创]第二题 子鼠开天

2020-4-16 17:06
2790
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env python3
from Crypto.Cipher import AES
import gmpy2
import hashlib
import binascii
from Crypto.Util.number import bytes_to_long
 
key = [0x480x0B0x620xC30xAC0xD60xC80xA30x6B0x180xD90xE90x060xCD0x900xD2]
# str to hex
# aes decryption
# mod_n = b'i\x820(Wte\xab9\x91\xdf\x04QF\xf9\x1dUm\xee\x88p\x84]\x8e\xe1\xcd<\xf7~J\x0c9'
mod_n = gmpy2.mpz(0x69823028577465ab3991df045146f91d556dee8870845d8ee1cd3cf77e4a0c39)
# 94aea8ebf17c84bb40acd07433e77dcd3038f95dc0ce1b427ac21f714d19c56f
# B1AC71D22D82EBB1
head = bytes([0xB90x790x370x9E])
tail = bytes([0xDE0xED0xBE0xEF])
 
def myhash(str):
    sha512 = hashlib.sha512()
    sha512.update(str)
    get_str = sha512.digest()
    md5 = hashlib.md5()
    md5.update(get_str)
    return md5.digest()
 
 
def genhash(username):
    temp = username + tail
    get_temp_hash = myhash(temp)
    return myhash(get_temp_hash + head)
 
 
print(genhash(b"B1AC71D22D82EBB1"))
# input_str == len(64)
# sn = binascii.unhexlify(input_str)
# aes = AES.new(bytes(key))
# temp_1 = aes.decrypt(sn)
# e = 65537
# get_final = gmpy2.powmod(bytes_to_long(temp_1), e, mod_n)
 
# hex(get_final[1]) == 2, hex(get_final[15]) == 0
# len(hex(get_final)) == 32


满足条件即可

[注意]看雪招聘,专注安全领域的专业人才平台!

收藏
免费
支持
分享
最新回复 (0)
游客
登录 | 注册 方可回帖
返回

账号登录
验证码登录

忘记密码?
没有账号?立即免费注册