summaryrefslogtreecommitdiff
path: root/pct-speedtest.py
diff options
context:
space:
mode:
authorDwayne Litzenberger <dlitz@dlitz.net>2013-07-14 00:56:57 -0700
committerDwayne Litzenberger <dlitz@dlitz.net>2013-07-14 01:04:21 -0700
commitf54fb9c65432513ed6c1de2513865e3be8f1b5f8 (patch)
tree22a16409004937f2bbfa20a422473658f5dbd563 /pct-speedtest.py
parent10abfc8633bac653eda4d346fc051b2f07554dcd (diff)
downloadpycrypto-f54fb9c65432513ed6c1de2513865e3be8f1b5f8.tar.gz
pct-speedtest.py: Add CTR-mode tests
Diffstat (limited to 'pct-speedtest.py')
-rw-r--r--pct-speedtest.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/pct-speedtest.py b/pct-speedtest.py
index 027a87f..132736c 100644
--- a/pct-speedtest.py
+++ b/pct-speedtest.py
@@ -159,6 +159,12 @@ class Benchmark:
blocks = self.random_blocks(16384, 1000)
if mode is None:
cipher = module.new(key)
+ elif mode == "CTR-BE":
+ from Crypto.Util import Counter
+ cipher = module.new(key, module.MODE_CTR, counter=Counter.new(module.block_size*8, little_endian=False))
+ elif mode == "CTR-LE":
+ from Crypto.Util import Counter
+ cipher = module.new(key, module.MODE_CTR, counter=Counter.new(module.block_size*8, little_endian=True))
else:
cipher = module.new(key, mode, iv)
@@ -330,6 +336,8 @@ class Benchmark:
self.test_encryption("%s-OFB" % (cipher_name,), module, key_bytes, module.MODE_OFB)
self.test_encryption("%s-ECB" % (cipher_name,), module, key_bytes, module.MODE_ECB)
self.test_encryption("%s-OPENPGP" % (cipher_name,), module, key_bytes, module.MODE_OPENPGP)
+ self.test_encryption("%s-CTR-BE" % (cipher_name,), module, key_bytes, "CTR-BE")
+ self.test_encryption("%s-CTR-LE" % (cipher_name,), module, key_bytes, "CTR-LE")
# Crypto.Cipher (stream ciphers)
for cipher_name, module, key_bytes in stream_specs: