python: how to encrypt a file?

百般思念 提交于 2019-12-31 02:32:06

问题


Can anybody help(or point to some examples) about how to encrypt files with python? I have to use following parameters to encrypt file:

block size=8
iv=qwertyui12345678
method=des3_cbc

Also I have no idea about what iv means

Please help. Thanks in advance.


回答1:


You will need to use the Python Crypto Toolkit

IV is the Initialisation Vector.




回答2:


Use pycrypto - note that implmenting crypto properly, even using a library for the hard parts, is tricky. If security matters get expert help.




回答3:


IV stands for Initialization Vector. Block cipher algorithms can be used in several operational modes; one of these modes is called CBC (Cipher-Block Chaining), in this mode the plain text block is XORed with the encrypted previous block. The IV is XORed with the initial plain text block. The IV can be see as an algorithm parameter.

A more detailed description can be read here.



来源:https://stackoverflow.com/questions/4936543/python-how-to-encrypt-a-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!