aboutsummaryrefslogtreecommitdiff
path: root/frozen_deps/Cryptodome/Cipher/_mode_cfb.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_cfb.py
parent258780284151d49cba1d9c0d2ce33f9a19bb058b (diff)
release v0.1.8
Diffstat (limited to 'frozen_deps/Cryptodome/Cipher/_mode_cfb.py')
-rw-r--r--frozen_deps/Cryptodome/Cipher/_mode_cfb.py22
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),