Module refinery.units.crypto.cipher.rc2

Expand source code Browse git
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from Cryptodome.Cipher import ARC2

from refinery.lib.crypto import PyCryptoFactoryWrapper
from refinery.units.crypto.cipher import StandardBlockCipherUnit, CipherInterface


class rc2(StandardBlockCipherUnit, cipher=PyCryptoFactoryWrapper(ARC2)):
    """
    RC2 encryption and decryption.
    """

    def _new_cipher(self, **optionals) -> CipherInterface:
        optionals.update(effective_keylen=max(ARC2.key_size))
        return super()._new_cipher(**optionals)

Classes

class rc2 (key, iv=b'', *, padding=None, mode=None, raw=False, little_endian=False, segment_size=0, mac_len=0, assoc_len=0)

RC2 encryption and decryption.

Expand source code Browse git
class rc2(StandardBlockCipherUnit, cipher=PyCryptoFactoryWrapper(ARC2)):
    """
    RC2 encryption and decryption.
    """

    def _new_cipher(self, **optionals) -> CipherInterface:
        optionals.update(effective_keylen=max(ARC2.key_size))
        return super()._new_cipher(**optionals)

Ancestors

Class variables

var block_size
var key_size

Inherited members