Senin, 01 Mei 2017

How to encrypt a file in python

Given the popularity of Python, at first I was disappointed that there was no complete answer to this question to be found. It took me a fair amount of reading different answers, as well as other resources, to get it right. I thought I might share the result for future reference and perhaps review; I’m by no means a cryptography expert! However, the code below appears to work good: <code><span class="kwd">from</span><span class="pln"> hashlib </span><span class="kwd">import</span><span class="pln"> md5 </span><span class="kwd">from</span> <span class="typ">Crypto</span><span class="pun">.</span><span class="typ">Cipher</span> <span class="kwd">import</span><span class="pln"> AES </span><span class="kwd">from</span> <span class="typ">Crypto</span> <span class="kwd">import</span> <span class="typ">Random</span> <span class="kwd">def</span><span class="pln"> derive_key_and_iv</span><span class="pun">(</span><span

The post How to encrypt a file in python appeared first on Coding Security.


How to encrypt a file in python
read more

Tidak ada komentar:

Posting Komentar