1. 程式人生 > >南京郵電大學網路攻防訓練平臺-密碼學-異性相吸

南京郵電大學網路攻防訓練平臺-密碼學-異性相吸

下載後是 兩個txt檔案 一個是密文txt 一個是明文txt 根據提示 把兩個檔案先轉換成bin形式,直接用010editor轉就行 然後把兩串二進位制數複製出來 寫個py進行異或演算法

a='0110110001101111011101100110010101101100011011110111011001100101011011000110111101110110011001010110110001101111011101100110010101101100011011110111011001100101011011000110111101110110011001010110110001101111011101100110010101101100011011110111011001100101'
b='0000101000000011000101110000001001010110000000010001010100010001000010100001010000001110000010100001111000110000000011100000101000011110001100000000111000001010000111100011000000010100000011000001100100001101000111110001000000001110000001100000001100011000'
c=''
for i in range(len(a)):
	if(a[i]==b[i]):
		c+='0'
	else:
		c+='1'
print c

然後把得到的一串二進位制數 轉化成字串就可以了,方法也很多這裡用的是,再複製回010editor