Exclude AES CTR from block size check

pull/61/head
Eric Blankenhorn 2023-12-26 16:32:20 -06:00 committed by Daniele Lacamera
parent 1c242652a7
commit e65ce4288a
1 changed files with 2 additions and 2 deletions

View File

@ -181,7 +181,7 @@ class _Cipher(object):
raise ValueError(
"empty string not allowed")
if len(string) % self.block_size and not "ChaCha" in self._native_type:
if len(string) % self.block_size and not self.mode == MODE_CTR and not "ChaCha" in self._native_type:
raise ValueError(
"string must be a multiple of %d in length" % self.block_size)
@ -214,7 +214,7 @@ class _Cipher(object):
raise ValueError(
"empty string not allowed")
if len(string) % self.block_size and not "ChaCha" in self._native_type:
if len(string) % self.block_size and not self.mode == MODE_CTR and not "ChaCha" in self._native_type:
raise ValueError(
"string must be a multiple of %d in length" % self.block_size)