众所周知,我可以读取内存中的整个文件内容,并使用以下代码对其进行加密。在
contents = fin.read()
cipher = M2Crypto.EVP.Cipher(alg="aes_128_cbc", key = aes_key, iv = aes_iv, op = 1)
encryptedContents = cipher.update(contents)
encryptedContents += cipher.final()
但是如果文件太大了,有没有办法让我把输入流传递给M2Crypto,而不是先读取整个文件呢?在
我知道你可以多次打电话更新数据。在
为了最大限度地减少内存使用并使用文件进行输出,您应该能够做到:
相关问题 更多 >
编程相关推荐