?? t_des.py
字號:
from M2Crypto import EVP,Randimport cStringIOdef cipher_filter(cipher,inf,outf): while 1: buf = inf.read() if not buf: break outf.write(cipher.update(buf)) outf.write(cipher.final()) return outf.getvalue()#def test():if __name__=='__main__': f=open('des_data/EFsk.4.bin','rb') key = f.read() f.close() enc=1 dec=0 skip=""" otxt='hello wolrd' k=EVP.Cipher('des_ede_cbc',key,'00000000',enc) #,1,'sha1','saltsalt',5) pbuf=cStringIO.StringIO(otxt) cbuf =cStringIO.StringIO() ctxt = cipher_filter(k,pbuf,cbuf) pbuf.close() cbuf.close()""" f1 = open('des_data/3DESEncrypted.bin','rb') ctxt = f1.read() f1.close() print `ctxt` j = EVP.Cipher('des_ede_cbc',key,'\x00\x00\x00\x00\x00\x00\x00\x00',dec) #,1,'sha1','saltsalt',5) pbuf =cStringIO.StringIO() cbuf =cStringIO.StringIO(ctxt) ptxt = cipher_filter(j, cbuf, pbuf) pbuf.close() cbuf.close() print `ptxt`
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -