Beispiel #1
0
    def __init__(self, key, *args, **kwargs):
        """Initialize an ARC4 cipher object
        
        See also `new()` at the module level."""

        self._cipher = _ARC4.new(key, *args, **kwargs)
        self.block_size = self._cipher.block_size
        self.key_size = self._cipher.key_size
Beispiel #2
0
    def __init__(self, key, *args, **kwargs):
        """Initialize an ARC4 cipher object
        
        See also `new()` at the module level."""

        self._cipher = _ARC4.new(key, *args, **kwargs)
        self.block_size = self._cipher.block_size
        self.key_size = self._cipher.key_size
 def __init__(self, key, *args, **kwargs):
     if len(args) > 0:
         ndrop = args[0]
         args = args[1:]
     else:
         ndrop = kwargs.get('drop', 0)
         if ndrop:
             del kwargs['drop']
     self._cipher = _ARC4.new(key, *args, **kwargs)
     if ndrop:
         self._cipher.encrypt(b('\x00') * ndrop)
     self.block_size = self._cipher.block_size
     self.key_size = self._cipher.key_size
Beispiel #4
0
    def __init__(self, key, *args, **kwargs):
        """Initialize an ARC4 cipher object
        
        See also `new()` at the module level."""

        if len(args)>0:
            ndrop = args[0]
            args = args[1:]
        else:
            ndrop = kwargs.get('drop', 0)
            if ndrop: del kwargs['drop'] 
        self._cipher = _ARC4.new(key, *args, **kwargs)
        if ndrop:
            # This is OK even if the cipher is used for decryption, since encrypt
            # and decrypt are actually the same thing with ARC4.
            self._cipher.encrypt(b('\x00')*ndrop)

        self.block_size = self._cipher.block_size
        self.key_size = self._cipher.key_size
Beispiel #5
0
    def __init__(self, key, *args, **kwargs):
        """Initialize an ARC4 cipher object
        
        See also `new()` at the module level."""

        if len(args) > 0:
            ndrop = args[0]
            args = args[1:]
        else:
            ndrop = kwargs.get('drop', 0)
            if ndrop: del kwargs['drop']
        self._cipher = _ARC4.new(key, *args, **kwargs)
        if ndrop:
            # This is OK even if the cipher is used for decryption, since encrypt
            # and decrypt are actually the same thing with ARC4.
            self._cipher.encrypt(b('\x00') * ndrop)

        self.block_size = self._cipher.block_size
        self.key_size = self._cipher.key_size