Skip to content

Commit 79f85f4

Browse files
committed
Fix cipher logic and validation
1 parent 6e8c43b commit 79f85f4

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

wolfcrypt/ciphers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def encrypt(self, string):
183183
raise ValueError(
184184
"empty string not allowed")
185185

186-
if len(string) % self.block_size and not self.mode == MODE_CTR and not "ChaCha" in self._native_type:
186+
if len(string) % self.block_size and "ChaCha" not in self._native_type and self.mode != MODE_CTR:
187187
raise ValueError(
188188
"string must be a multiple of %d in length" % self.block_size)
189189

@@ -216,7 +216,7 @@ def decrypt(self, string):
216216
raise ValueError(
217217
"empty string not allowed")
218218

219-
if len(string) % self.block_size and not self.mode == MODE_CTR and not "ChaCha" in self._native_type:
219+
if len(string) % self.block_size and "ChaCha" not in self._native_type and self.mode != MODE_CTR:
220220
raise ValueError(
221221
"string must be a multiple of %d in length" % self.block_size)
222222

0 commit comments

Comments
 (0)