From e8f6d2bcad12e62ba33e7b74bd9bac85b538576c Mon Sep 17 00:00:00 2001 From: Siddharth Ravikumar Date: Thu, 15 Oct 2015 22:47:04 -0400 Subject: combox/crypto.py: the split_and_encrypt function is timed now. --- combox/crypto.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'combox') 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): -- cgit v1.2.3