SIPHASH24(3) | Library Functions Manual | SIPHASH24(3)

# NAME

`SipHash24_Init`, `SipHash24_Update`, `SipHash24_End`, `SipHash24_Final`, `SipHash24` — calculate SipHash24 hashes

# SYNOPSIS

`#include <siphash.h>`

void
`SipHash24_Init`(SIPHASH_CTX *ctx, const SIPHASH_KEY *key);

void
`SipHash24_Update`(SIPHASH_CTX *ctx, const void *data, size_t len);

uint64_t
`SipHash24_End`(SIPHASH_CTX *ctx);

void
`SipHash24_Final`(void *digest, SIPHASH_CTX *ctx);

uint64_t
`SipHash24`(const SIPHASH_KEY *key, const void *data, size_t len);

# DESCRIPTION

The SipHash algorithm is a keyed hash algorithm optimised for short inputs which produces a 64-bit digest of data. The SipHash24 functions implement the algorithm with 2 compression rounds and 4 finalisation rounds.

`SipHash24_Init`() initialises a SIPHASH_CTX context ctx with the secret key.

`SipHash24_Update`() adds data of length len to the context ctx.

`SipHash24_End`() is called after all data has been added to ctx via `SipHash24_Update`() and returns a message digest in the host's native endian.

`SipHash24_Final`() is called after all data has been added to ctx via `SipHash24_Update`() and stores the message digest at the address specified by the digest parameter. The buffer at digest must be `SIPHASH_DIGEST_LENGTH` bytes long.

`SipHash24`() calculates the digest of data of length len with the secret key.

It is recommended that the SIPHASH_KEY key be generated with arc4random_buf(3).

# RETURN VALUES

`SipHash24_End`() and `SipHash24`() return the 64-bit message digest in the host's native endian representation.

# SEE ALSO

arc4random_buf(3)

# HISTORY

These functions appeared in OpenBSD 5.7.

August 30, 2019 | Debian