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

14 public symbols.

### Types

#### `fio_sha256_s`

```c
typedef struct {
fio_u256 hash;
fio_u512 cache;
uint64_t total_len;
} fio_sha256_s
```

Streaming SHA-256 type.

_Symbol type:_ `type`

#### `fio_sha512_s`

```c
typedef struct {
fio_u512 hash;
fio_u1024 cache;
uint64_t total_len;
} fio_sha512_s
```

Streaming SHA-512 type.

_Symbol type:_ `type`

### Functions

#### `fio_sha256`

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

A simple, non streaming, implementation of the SHA-256 hashing algorithm.

_Symbol type:_ `function`

#### `fio_sha256_init`

```c
inline fio_sha256_s fio_sha256_init(void)
```

initializes a fio_u256 so the hash can consume streaming data.

_Symbol type:_ `function`

#### `fio_sha256_consume`

```c
void fio_sha256_consume(fio_sha256_s *h, const void *data, uint64_t len)
```

Feed data into the hash

_Symbol type:_ `function`

#### `fio_sha256_finalize`

```c
fio_u256 fio_sha256_finalize(fio_sha256_s *h)
```

finalizes a fio_u256 with the SHA 256 hash.

_Symbol type:_ `function`

#### `fio_sha512`

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

A simple, non streaming, implementation of the SHA-512 hashing algorithm.

_Symbol type:_ `function`

#### `fio_sha512_init`

```c
inline fio_sha512_s fio_sha512_init(void)
```

initializes a fio_u512 so the hash can consume streaming data.

_Symbol type:_ `function`

#### `fio_sha512_consume`

```c
void fio_sha512_consume(fio_sha512_s *h, const void *data, uint64_t len)
```

Feed data into the hash

_Symbol type:_ `function`

#### `fio_sha512_finalize`

```c
fio_u512 fio_sha512_finalize(fio_sha512_s *h)
```

finalizes a fio_u512 with the SHA 512 hash.

_Symbol type:_ `function`

#### `fio_sha384_init`

```c
inline fio_sha512_s fio_sha384_init(void)
```

initializes a fio_u512 so the hash can consume streaming data (SHA-384).

SHA-384 is SHA-512 with different initial values, truncated to 48 bytes.
NOTE: truncating a SHA-512 result is NOT the same as SHA-384.

_Symbol type:_ `function`

#### `fio_sha384_consume`

```c
#define fio_sha384_consume fio_sha512_consume
```

Feed data into the hash

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

_Symbol type:_ `macro`

#### `fio_sha384_finalize`

```c
#define fio_sha384_finalize fio_sha512_finalize
```

finalizes a fio_u512 with the SHA 384 hash (first 48 bytes are the hash).

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

_Symbol type:_ `macro`

#### `fio_sha384`

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

A simple, non streaming, implementation of the SHA-384 hashing algorithm.
Returns a fio_u512 of which the first 48 bytes hold the SHA-384 hash.

_Symbol type:_ `function`

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