Module refinery.units.crypto.keyderive.pbkdf1

Expand source code Browse git
from __future__ import annotations

import codecs

from refinery.units.crypto.keyderive import Arg, KeyDerivation


class pbkdf1(KeyDerivation):
    """
    PBKDF1 key derivation as specified in RFC 2898. A password-based key derivation function using
    iterated hashing, predecessor to PBKDF2.
    """

    @Arg('salt', help='Salt for the derivation; default are 8 null bytes.')
    def __init__(self, size, salt=bytes(8), iter=1000, hash='SHA1'):
        self.superinit(super(), **vars())

    def keystream(self, seed):
        from Cryptodome.Protocol.KDF import PBKDF1
        return PBKDF1(
            codecs.decode(seed, self.codec),
            self.args.salt,
            dkLen=self._hash_interface().digest_size,
            count=self.args.iter,
            hashAlgo=self._hash_module(),
        )

Classes

class pbkdf1 (size, salt=b'\x00\x00\x00\x00\x00\x00\x00\x00', iter=1000, hash='SHA1')

PBKDF1 key derivation as specified in RFC 2898. A password-based key derivation function using iterated hashing, predecessor to PBKDF2.

Expand source code Browse git
class pbkdf1(KeyDerivation):
    """
    PBKDF1 key derivation as specified in RFC 2898. A password-based key derivation function using
    iterated hashing, predecessor to PBKDF2.
    """

    @Arg('salt', help='Salt for the derivation; default are 8 null bytes.')
    def __init__(self, size, salt=bytes(8), iter=1000, hash='SHA1'):
        self.superinit(super(), **vars())

    def keystream(self, seed):
        from Cryptodome.Protocol.KDF import PBKDF1
        return PBKDF1(
            codecs.decode(seed, self.codec),
            self.args.salt,
            dkLen=self._hash_interface().digest_size,
            count=self.args.iter,
            hashAlgo=self._hash_module(),
        )

Ancestors

Subclasses

Class variables

var reverse

The type of the None singleton.

Methods

def keystream(self, seed)
Expand source code Browse git
def keystream(self, seed):
    from Cryptodome.Protocol.KDF import PBKDF1
    return PBKDF1(
        codecs.decode(seed, self.codec),
        self.args.salt,
        dkLen=self._hash_interface().digest_size,
        count=self.args.iter,
        hashAlgo=self._hash_module(),
    )

Inherited members