# nacl.hash

nacl.hash.sha256(message, encoder)

  Hashes `message` with SHA256.

  Parameters:

    - message (bytes) – The message to hash.

    - encoder – A class that is able to encode the hashed message.

  Return bytes:

    The hashed message.

nacl.hash.sha512(message, encoder)

  Hashes `message` with SHA512.

  Parameters:

    - message (bytes) – The message to hash.

    - encoder – A class that is able to encode the hashed message.

  Return bytes:

    The hashed message.

nacl.hash.blake2b(data, digest_size=BLAKE2B_BYTES, key=b'', salt=b'', person=b'', encoder=nacl.encoding.HexEncoder)

  One-shot blake2b digest

  Parameters:

    - data (bytes) – the digest input byte sequence

    - digest_size (int) – the requested digest size; must be at most `BLAKE2B_BYTES_MAX`; the default digest size is `BLAKE2B_BYTES`

    - key (bytes) – the key to be set for keyed MAC/PRF usage; if set, the key must be at most `BLAKE2B_KEYBYTES_MAX` long

    - salt (bytes) – an initialization salt at most `BLAKE2B_SALTBYTES` long; it will be zero-padded if needed

    - person (bytes) – a personalization string at most `BLAKE2B_PERSONALBYTES` long; it will be zero-padded if needed

    - encoder (class) – the encoder to use on returned digest

  Returns:

    encoded bytes data

  Return type:

    the return type of the chosen encoder

nacl.hash.siphash24(message, key=b'', encoder=nacl.encoding.HexEncoder)

  Computes a keyed MAC of `message` using siphash-2-4

  Parameters:

    - message (bytes) – The message to hash.

    - key (bytes(`SIPHASH_KEYBYTES`)) – the message authentication key to be used It must be a `SIPHASH_KEYBYTES` long bytes sequence

    - encoder – A class that is able to encode the hashed message.

  Returns:

    The hashed message.

  Return type:

    bytes(`SIPHASH_BYTES`) long bytes sequence

nacl.hash.siphashx24(message, key=b'', encoder=nacl.encoding.HexEncoder)

  Added in version 1.2.

  Computes a keyed MAC of `message` using the extended output length variant of siphash-2-4

  Parameters:

    - message (bytes) – The message to hash.

    - key (bytes(`SIPHASHX_KEYBYTES`)) – the message authentication key to be used It must be a `SIPHASHX_KEYBYTES` long bytes sequence

    - encoder – A class that is able to encode the hashed message.

  Returns:

    The hashed message.

  Return type:

    bytes(`SIPHASHX_BYTES`) long bytes sequence

  Raises:

    nacl.exceptions.UnavailableError – If called when using a minimal build of libsodium.