DDCTF联盟决策大会-shamir解密

拿到题目是一个shamir解密和一堆十六进制字符串,使用脚本解密

import shamir

p=0x85FE375B8CDB346428F81C838FCC2D1A1BCDC7A0A08151471B203CDDF015C6952919B1DE33F21FB80018F5EA968BA023741AAA50BE53056DE7303EF702216EE9

pairs1 = []

pairs1 += [(1,0x60E455AAEE0E836E518364442BFEAB8E5F4E77D16271A7A7B73E3A280C5E8FD142D3E5DAEF5D21B5E3CBAA6A5AB22191AD7C6A890D9393DBAD8230D0DC496964)]

pairs1 += [(2,0x6D8B52879E757D5CEB8CBDAD3A0903EEAC2BB89996E89792ADCF744CF2C42BD3B4C74876F32CF089E49CDBF327FA6B1E36336CBCADD5BE2B8437F135BE586BB1)]

pairs1 += [(4,0x74C0EEBCA338E89874B0D270C143523D0420D9091EDB96D1904087BA159464BF367B3C9F248C5CACC0DECC504F14807041997D86B0386468EC504A158BE39D7)]

pairs2 = []

pairs2 += [(3,0x560607563293A98D6D6CCB219AC74B99931D06F7DEBBFDC2AFCC360A12A97D9CA950475036497F44F41DC5492977F9B4A0E4C8E0368C7606B7B82C34F561525)]

pairs2 += [(4,0x445CCE871E61AD5FDE78ECE87C42219D5C9F372E5BEC90C4C4990D2F37755A4082C7B52214F897E4EC1B5FB4A296DBE5718A47253CC6E8EAF4584625D102CC62)]

pairs2 += [(5,0x4F148B40332ACCCDC689C2A742349AEBBF01011BA322D07AD0397CE0685700510A34BDC062B26A96778FA1D0D4AFAF9B0507CC7652B0001A2275747D518EDDF5)]





pairs3=[]

pairs3+=[(1,shamir.recover_secret(shares=pairs1,prime=p))]

pairs3+=[(2,shamir.recover_secret(shares=pairs2,prime=p))]



res=shamir.recover_secret(shares=pairs3,prime=p)

print(hex(res)[2:-1].decode("hex"))

便可以拿到flag

你可能感兴趣的:(CTF-MISC)