diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2014-02-16 19:54:10 -0800 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2014-02-16 19:54:10 -0800 |
commit | 3c93e511eed890d397b21fdb6040d252061268ea (patch) | |
tree | 7fa40778e253b080124564e7ed7ce184282a33e3 /docs/development/custom-vectors/cast5/generate_cast5.py | |
parent | f4c1429a705f0d77ea860f0a765602cb97a2d35a (diff) | |
parent | e1dbd3a3ca82d5f6aa3c5da6f7e29d0d487a9c61 (diff) | |
download | cryptography-3c93e511eed890d397b21fdb6040d252061268ea.tar.gz cryptography-3c93e511eed890d397b21fdb6040d252061268ea.tar.bz2 cryptography-3c93e511eed890d397b21fdb6040d252061268ea.zip |
Merge pull request #626 from reaperhulk/cast5-ctr-vectors
CAST5 CTR vectors
Diffstat (limited to 'docs/development/custom-vectors/cast5/generate_cast5.py')
-rw-r--r-- | docs/development/custom-vectors/cast5/generate_cast5.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/docs/development/custom-vectors/cast5/generate_cast5.py b/docs/development/custom-vectors/cast5/generate_cast5.py index c3f579e7..32ef3b43 100644 --- a/docs/development/custom-vectors/cast5/generate_cast5.py +++ b/docs/development/custom-vectors/cast5/generate_cast5.py @@ -1,6 +1,6 @@ import binascii -from cryptography.hazmat.backends.openssl.backend import backend +from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives.ciphers import base, algorithms, modes @@ -8,7 +8,7 @@ def encrypt(mode, key, iv, plaintext): cipher = base.Cipher( algorithms.CAST5(binascii.unhexlify(key)), mode(binascii.unhexlify(iv)), - backend + default_backend() ) encryptor = cipher.encryptor() ct = encryptor.update(binascii.unhexlify(plaintext)) @@ -57,3 +57,5 @@ ofb_path = "tests/hazmat/primitives/vectors/ciphers/AES/OFB/OFBMMT128.rsp" write_file(build_vectors(modes.OFB, ofb_path), "cast5-ofb.txt") cfb_path = "tests/hazmat/primitives/vectors/ciphers/AES/CFB/CFB128MMT128.rsp" write_file(build_vectors(modes.CFB, cfb_path), "cast5-cfb.txt") +ctr_path = "tests/hazmat/primitives/vectors/ciphers/AES/CTR/aes-128-ctr.txt" +write_file(build_vectors(modes.CTR, ctr_path), "cast5-ctr.txt") |