diff options
author | Siddharth Ravikumar <sravik@bgsu.edu> | 2015-10-15 22:47:04 -0400 |
---|---|---|
committer | Siddharth Ravikumar <sravik@bgsu.edu> | 2015-10-15 22:47:04 -0400 |
commit | e8f6d2bcad12e62ba33e7b74bd9bac85b538576c (patch) | |
tree | 0d3930f5ab6d6f95fe122ba8688548be705c8c51 | |
parent | 0cfeecae844dc1f16f5d5dac8a3cd91ae9d34675 (diff) |
combox/crypto.py: the split_and_encrypt function is timed now.
-rw-r--r-- | combox/crypto.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/combox/crypto.py b/combox/crypto.py index e7752d2..f0cafe1 100644 --- a/combox/crypto.py +++ b/combox/crypto.py @@ -26,8 +26,10 @@ from combox.file import (read_file, write_file, read_shards, write_shards, split_data, glue_data, relative_path) +from combox.log import log_i from Crypto.Cipher import AES +from datetime import datetime from os import path BLOCK_SIZE = 32 @@ -103,6 +105,8 @@ def split_and_encrypt(fpath, config, fcontent=None): the file. """ + start = datetime.now() + rel_path = relative_path(fpath, config) # no. of shards = no. of nodes. @@ -126,6 +130,11 @@ def split_and_encrypt(fpath, config, fcontent=None): write_shards(ciphered_shards, nodes, f_basename) + end = datetime.now() + duration = (end - start).total_seconds() * pow(10, 3) + log_i('Took %f ms to split and encrypt %s' % (duration, fpath)) + + def decrypt_and_glue(fpath, config, write=True): |