jeudi 6 avril 2017

pyCrypto's Random function not reliable for large scale data?

I have a python script that uses hybrid encryption (AES + PKI) to encrypt files. I tested it with a few small files and a few really large files (50 GB+) and it worked just fine.

However, I recently ran it against 30,000 files at once and for every 3,000 files that it processes, I get 10 corrupt files.

I am using pyCrypto's Random.get_random_bytes(128) to generate a symmetric key. When I change my symmetric key generation function to return a static text instead of using Random.get_random_bytes(128), I do NOT see any corrupt files at all.

How do I go about this? I do have a requirement that I need to use some kind of random unpredictable number as symmetric keys. Can I use UUID() instead? Are there other random number/text generator that won't choke while processing multiple thousand files?




Aucun commentaire:

Enregistrer un commentaire