Skip to content

Commit dd3fee9

Browse files
committed
Fix cipher logic and validation
1 parent 6fbdf3d commit dd3fee9

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

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

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

0 commit comments

Comments
 (0)