# `./fio-stl/152 blake2.h`

14 public symbols.

### Types

#### `fio_blake2b_s`

```c
typedef struct {
uint64_t h[8]; /* state */
uint64_t t[2]; /* total bytes processed (128-bit counter) */
uint64_t f[2]; /* finalization flags */
uint8_t buf[128]; /* input buffer */
size_t buflen; /* bytes in buffer */
size_t outlen; /* digest length */
} fio_blake2b_s
```

Streaming BLAKE2b type (64-bit, up to 64-byte digest).

_Symbol type:_ `type`

#### `fio_blake2s_s`

```c
typedef struct {
uint32_t h[8]; /* state */
uint32_t t[2]; /* total bytes processed (64-bit counter) */
uint32_t f[2]; /* finalization flags */
uint8_t buf[64]; /* input buffer */
size_t buflen; /* bytes in buffer */
size_t outlen; /* digest length */
} fio_blake2s_s
```

Streaming BLAKE2s type (32-bit, up to 32-byte digest).

_Symbol type:_ `type`

### Functions

#### `fio_blake2b`

```c
inline fio_u512 fio_blake2b(const void *data, uint64_t len)
```

One-shot BLAKE2b hash with max-length (64 byte) digest.

_Symbol type:_ `function`

#### `fio_blake2b_hash`

```c
void fio_blake2b_hash(void *restrict out, size_t outlen, const void *restrict data, size_t len, const void *restrict key, size_t keylen)
```

Flexible-output BLAKE2b hash.

`out` must point to a buffer of at least `outlen` bytes.
`outlen` must be between 1 and 64 (default 64 if 0).
`key` and `keylen` are optional (set to NULL/0 for unkeyed hashing).

_Symbol type:_ `function`

#### `fio_blake2b_hmac`

```c
fio_u512 fio_blake2b_hmac(const void *key, uint64_t key_len, const void *msg, uint64_t msg_len)
```

HMAC-BLAKE2b (64 byte key, 64 byte digest), compatible with SHA HMAC.

_Symbol type:_ `function`

#### `fio_blake2b_init`

```c
fio_blake2b_s fio_blake2b_init(size_t outlen, const void *key, size_t keylen)
```

Initialize a BLAKE2b streaming context. outlen: 1-64 (default 64).

_Symbol type:_ `function`

#### `fio_blake2b_consume`

```c
void fio_blake2b_consume(fio_blake2b_s *restrict h, const void *restrict data, size_t len)
```

Feed data into BLAKE2b hash.

_Symbol type:_ `function`

#### `fio_blake2b_finalize`

```c
fio_u512 fio_blake2b_finalize(fio_blake2b_s *h)
```

Finalize BLAKE2b hash. Returns result in fio_u512 (valid bytes = outlen).

_Symbol type:_ `function`

#### `fio_blake2s`

```c
inline fio_u256 fio_blake2s(const void *data, uint64_t len)
```

One-shot BLAKE2s hash with max-length (32 byte) digest.

_Symbol type:_ `function`

#### `fio_blake2s_hash`

```c
void fio_blake2s_hash(void *restrict out, size_t outlen, const void *restrict data, size_t len, const void *restrict key, size_t keylen)
```

Flexible-output BLAKE2s hash.

`out` must point to a buffer of at least `outlen` bytes.
`outlen` must be between 1 and 32 (default 32 if 0).
`key` and `keylen` are optional (set to NULL/0 for unkeyed hashing).

_Symbol type:_ `function`

#### `fio_blake2s_hmac`

```c
fio_u256 fio_blake2s_hmac(const void *key, uint64_t key_len, const void *msg, uint64_t msg_len)
```

HMAC-BLAKE2s (32 byte key, 32 byte digest), compatible with SHA HMAC.

_Symbol type:_ `function`

#### `fio_blake2s_init`

```c
fio_blake2s_s fio_blake2s_init(size_t outlen, const void *key, size_t keylen)
```

Initialize a BLAKE2s streaming context. outlen: 1-32 (default 32).

_Symbol type:_ `function`

#### `fio_blake2s_consume`

```c
void fio_blake2s_consume(fio_blake2s_s *restrict h, const void *restrict data, size_t len)
```

Feed data into BLAKE2s hash.

_Symbol type:_ `function`

#### `fio_blake2s_finalize`

```c
fio_u256 fio_blake2s_finalize(fio_blake2s_s *h)
```

Finalize BLAKE2s hash. Returns result in fio_u256 (valid bytes = outlen).

_Symbol type:_ `function`

-----------------------------------------------------
