# `./fio-stl/159 argon2.h`

6 public symbols.

### Types

#### `fio_argon2_type_e`

```c
typedef enum {
FIO_ARGON2D = 0,
FIO_ARGON2I = 1,
FIO_ARGON2ID = 2,
} fio_argon2_type_e
```

Argon2 type selector.

_Symbol type:_ `type`

#### `fio_argon2_args_s`

```c
typedef struct {
/** The password (message P). */
fio_buf_info_s password;
/** The salt (nonce S). */
fio_buf_info_s salt;
/** Optional secret key K. */
fio_buf_info_s secret;
/** Optional associated data X. */
fio_buf_info_s ad;
/** Time cost (number of passes t, minimum 1). */
uint32_t t_cost;
/** Memory cost in KiB (minimum 8*parallelism). */
uint32_t m_cost;
/** Degree of parallelism (number of lanes, minimum 1). */
uint32_t parallelism;
/** Desired output (tag) length in bytes (minimum 4, default 32). */
uint32_t outlen;
/** Argon2 variant: FIO_ARGON2D, FIO_ARGON2I, or FIO_ARGON2ID. */
fio_argon2_type_e type;
} fio_argon2_args_s
```

Argon2 named arguments.

_Symbol type:_ `type`

### Functions

#### `fio_argon2`

```c
fio_u512 fio_argon2(fio_argon2_args_s args)
```

Computes Argon2 password hash (RFC 9106).

Supports Argon2d, Argon2i, and Argon2id variants.
Output is written to the returned buffer (up to 64 bytes via fio_u512).
For outlen > 64, use fio_argon2_hash() instead.

Use `fio_ct_is_eq` to compare output hashes in constant time.

_Symbol type:_ `function`

#### `fio_argon2`

```c
#define fio_argon2(...) fio_argon2((fio_argon2_args_s){__VA_ARGS__})
```



_Note:_ this may be a macro only / macro wrapper for a function.

_Symbol type:_ `macro`

#### `fio_argon2_hash`

```c
int fio_argon2_hash(void *out, fio_argon2_args_s args)
```

Computes Argon2 password hash into a caller-provided buffer.
Supports arbitrary output lengths (minimum 4 bytes).
Returns 0 on success, -1 on error.

_Symbol type:_ `function`

#### `fio_argon2_hash`

```c
#define fio_argon2_hash(out, ...)   \
  fio_argon2_hash(out, (fio_argon2_args_s){__VA_ARGS__})
```



_Note:_ this may be a macro only / macro wrapper for a function.

_Symbol type:_ `macro`

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