Skip to content

Commit ff57c98

Browse files
committed
adds a simple handler check for all block cipher units
1 parent b474262 commit ff57c98

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

refinery/units/crypto/cipher/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,11 @@ def decrypt(self, data: Chunk) -> buf:
274274
self.log_warn(F'removing {overlap} bytes from the input to make it a multiple of the {self.block_size}-byte block size')
275275
return self._get_cipher(True).decrypt(data)
276276

277+
@classmethod
278+
def handles(cls, data) -> bool | None:
279+
if len(data) % cls.block_size == 0:
280+
return True
281+
277282

278283
class StandardBlockCipherUnit(BlockCipherUnitBase, StandardCipherUnit):
279284

0 commit comments

Comments
 (0)