-
-
[原创]第二题 子鼠开天
-
发表于: 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 = [ 0x48 , 0x0B , 0x62 , 0xC3 , 0xAC , 0xD6 , 0xC8 , 0xA3 , 0x6B , 0x18 , 0xD9 , 0xE9 , 0x06 , 0xCD , 0x90 , 0xD2 ] # 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([ 0xB9 , 0x79 , 0x37 , 0x9E ]) tail = bytes([ 0xDE , 0xED , 0xBE , 0xEF ]) 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 |


满足条件即可
赞赏
他的文章
赞赏
雪币:
留言: