keyrings/cryptfile/cryptfile.py
def _create_cipher(self, password, salt, nonce = None):
        """
        Create the cipher object to encrypt or decrypt a payload.
        """
        from argon2.low_level import hash_secret_raw, Type
        from Crypto.Cipher import AES

        aesmode = self._get_mode(self.aesmode)
        if aesmode is None:     # pragma: no cover
            raise ValueError('invalid AES mode: %s' % self.aesmode)

        key = hash_secret_raw(
            secret = password.encode(self.password_encoding),
            salt = salt,
            time_cost = self.time_cost,
            memory_cost = self.memory_cost,
            parallelism = self.parallelism,
            hash_len = 16,
            type = Type.ID)

        return AES.new(key, aesmode, nonce)
def _create_cipher(self, password, salt, nonce = None):
        """
        Create the cipher object to encrypt or decrypt a payload.
        """
        from argon2.low_level import hash_secret_raw, Type
        from Crypto.Cipher import AES

        aesmode = self._get_mode(self.aesmode)
        if aesmode is None:     # pragma: no cover
            raise ValueError('invalid AES mode: %s' % self.aesmode)

        key = hash_secret_raw(
            secret = password.encode(self.password_encoding),
            salt = salt,
            time_cost = self.time_cost,
            memory_cost = self.memory_cost,
            parallelism = self.parallelism,
            hash_len = 16,
            type = Type.ID)

        return AES.new(key, aesmode, nonce)
Create the cipher object to encrypt or decrypt a payload.