aboutsummaryrefslogtreecommitdiff
path: root/frozen_deps/Cryptodome/Cipher/_mode_cbc.py
diff options
context:
space:
mode:
Diffstat (limited to 'frozen_deps/Cryptodome/Cipher/_mode_cbc.py')
-rw-r--r--frozen_deps/Cryptodome/Cipher/_mode_cbc.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/frozen_deps/Cryptodome/Cipher/_mode_cbc.py b/frozen_deps/Cryptodome/Cipher/_mode_cbc.py
index edc29ca..94d02e7 100644
--- a/frozen_deps/Cryptodome/Cipher/_mode_cbc.py
+++ b/frozen_deps/Cryptodome/Cipher/_mode_cbc.py
@@ -120,7 +120,7 @@ class CbcMode(object):
self.IV = self.iv
"""Alias for `iv`"""
- self._next = [ self.encrypt, self.decrypt ]
+ self._next = ["encrypt", "decrypt"]
def encrypt(self, plaintext, output=None):
"""Encrypt data with the key and the parameters set at initialization.
@@ -158,18 +158,18 @@ class CbcMode(object):
Otherwise, ``None``.
"""
- if self.encrypt not in self._next:
+ if "encrypt" not in self._next:
raise TypeError("encrypt() cannot be called after decrypt()")
- self._next = [ self.encrypt ]
-
+ self._next = ["encrypt"]
+
if output is None:
ciphertext = create_string_buffer(len(plaintext))
else:
ciphertext = output
-
+
if not is_writeable_buffer(output):
raise TypeError("output must be a bytearray or a writeable memoryview")
-
+
if len(plaintext) != len(output):
raise ValueError("output must have the same length as the input"
" (%d bytes)" % len(plaintext))
@@ -221,10 +221,10 @@ class CbcMode(object):
Otherwise, ``None``.
"""
- if self.decrypt not in self._next:
+ if "decrypt" not in self._next:
raise TypeError("decrypt() cannot be called after encrypt()")
- self._next = [ self.decrypt ]
-
+ self._next = ["decrypt"]
+
if output is None:
plaintext = create_string_buffer(len(ciphertext))
else:
@@ -232,7 +232,7 @@ class CbcMode(object):
if not is_writeable_buffer(output):
raise TypeError("output must be a bytearray or a writeable memoryview")
-
+
if len(ciphertext) != len(output):
raise ValueError("output must have the same length as the input"
" (%d bytes)" % len(plaintext))
@@ -285,7 +285,7 @@ def _create_cbc_cipher(factory, **kwargs):
if len(iv) != factory.block_size:
raise ValueError("Incorrect IV length (it must be %d bytes long)" %
- factory.block_size)
+ factory.block_size)
if kwargs:
raise TypeError("Unknown parameters for CBC: %s" % str(kwargs))