Module refinery.units.crypto.keyderive.hmac

Expand source code Browse git
from __future__ import annotations

from refinery.units.crypto.keyderive import KeyDerivation


class hmac(KeyDerivation):
    """
    HMAC based key derivation. Computes a keyed-hash message authentication code, commonly used for
    message integrity and key derivation in cryptographic protocols.
    """

    def __init__(self, salt, hash='SHA1', size=None):
        super().__init__(salt=salt, size=size, hash=hash)

    def process(self, data):
        from Cryptodome.Hash import HMAC
        return HMAC.new(data, self.args.salt, digestmod=self.hash).digest()

Classes

class hmac (salt, hash='SHA1', size=None)

HMAC based key derivation. Computes a keyed-hash message authentication code, commonly used for message integrity and key derivation in cryptographic protocols.

Expand source code Browse git
class hmac(KeyDerivation):
    """
    HMAC based key derivation. Computes a keyed-hash message authentication code, commonly used for
    message integrity and key derivation in cryptographic protocols.
    """

    def __init__(self, salt, hash='SHA1', size=None):
        super().__init__(salt=salt, size=size, hash=hash)

    def process(self, data):
        from Cryptodome.Hash import HMAC
        return HMAC.new(data, self.args.salt, digestmod=self.hash).digest()

Ancestors

Subclasses

Class variables

var reverse

The type of the None singleton.

Inherited members