⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 t_des.py

📁 It is an experimental testing for python M2Crypto module. M2Crypto is not well document. User may no
💻 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 + -