diff options
Diffstat (limited to 'frozen_deps/Cryptodome/Cipher/_mode_cfb.py')
-rw-r--r-- | frozen_deps/Cryptodome/Cipher/_mode_cfb.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/frozen_deps/Cryptodome/Cipher/_mode_cfb.py b/frozen_deps/Cryptodome/Cipher/_mode_cfb.py index b790dd4..1b1b6c3 100644 --- a/frozen_deps/Cryptodome/Cipher/_mode_cfb.py +++ b/frozen_deps/Cryptodome/Cipher/_mode_cfb.py @@ -119,7 +119,7 @@ class CfbMode(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. @@ -154,18 +154,18 @@ class CfbMode(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)) @@ -215,10 +215,10 @@ class CfbMode(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: @@ -226,11 +226,11 @@ class CfbMode(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)) - + result = raw_cfb_lib.CFB_decrypt(self._state.get(), c_uint8_ptr(ciphertext), c_uint8_ptr(plaintext), |