aboutsummaryrefslogtreecommitdiff
path: root/frozen_deps/Cryptodome/Cipher/_mode_cbc.py
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2024-08-23 03:14:03 +0000
committerDeterminant <[email protected]>2024-08-22 20:34:57 -0700
commit8d1c76ec7caf247d5675e14260d20fc508977ffb (patch)
tree8fa7c8ce3b7e3f4ece150a6da5922b5eb2dc7772 /frozen_deps/Cryptodome/Cipher/_mode_cbc.py
parent258780284151d49cba1d9c0d2ce33f9a19bb058b (diff)
release v0.1.8
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))