Skip to content

File syn_sha512.c

FileList > crypto > syn_sha512.c

Go to the source code of this file

SHA-512 & SHA-384 cryptographic hash and HMAC implementation.

  • #include "syn_sha512.h"
  • #include <string.h>

Public Functions

Type Name
void syn_hmac_sha384 (const void * key, size_t key_len, const void * data, size_t data_len, uint8_t mac)
Compute HMAC-SHA384 over data using secret key (RFC 4231).
void syn_hmac_sha384_final (SYN_HMAC_SHA384 * ctx, uint8_t mac)
Finalize HMAC-SHA384 computation and retrieve 48-byte MAC.
void syn_hmac_sha384_init (SYN_HMAC_SHA384 * ctx, const void * key, size_t key_len)
Initialize HMAC-SHA384 context with a key.
void syn_hmac_sha384_update (SYN_HMAC_SHA384 * ctx, const void * data, size_t len)
Feed data chunk into HMAC-SHA384 computation.
void syn_hmac_sha512 (const void * key, size_t key_len, const void * data, size_t data_len, uint8_t mac)
Compute HMAC-SHA512 over data using secret key (RFC 4231).
void syn_hmac_sha512_final (SYN_HMAC_SHA512 * ctx, uint8_t mac)
Finalize HMAC-SHA512 computation and retrieve 64-byte MAC.
void syn_hmac_sha512_init (SYN_HMAC_SHA512 * ctx, const void * key, size_t key_len)
Initialize HMAC-SHA512 context with a key.
void syn_hmac_sha512_update (SYN_HMAC_SHA512 * ctx, const void * data, size_t len)
Feed data chunk into HMAC-SHA512 computation.
void syn_sha384 (const void * data, size_t len, uint8_t hash)
One-shot SHA-384 calculation.
void syn_sha384_final (SYN_SHA512 * ctx, uint8_t hash)
Finalize SHA-384 hash and produce 48-byte digest.
void syn_sha384_init (SYN_SHA512 * ctx)
Initialize context for SHA-384 hashing.
void syn_sha512 (const void * data, size_t len, uint8_t hash)
One-shot SHA-512 calculation.
void syn_sha512_final (SYN_SHA512 * ctx, uint8_t hash)
Finalize SHA-512 hash and produce 64-byte digest.
void syn_sha512_init (SYN_SHA512 * ctx)
Initialize context for SHA-512 hashing.
void syn_sha512_update (SYN_SHA512 * ctx, const void * data, size_t len)
Feed data into the SHA-512 / SHA-384 hash.

Public Functions Documentation

function syn_hmac_sha384

Compute HMAC-SHA384 over data using secret key (RFC 4231).

void syn_hmac_sha384 (
    const void * key,
    size_t key_len,
    const void * data,
    size_t data_len,
    uint8_t mac
) 

Parameters:

  • key Secret key buffer.
  • key_len Secret key length in bytes.
  • data Data buffer to authenticate.
  • data_len Data length in bytes.
  • mac Output 48-byte MAC buffer.

function syn_hmac_sha384_final

Finalize HMAC-SHA384 computation and retrieve 48-byte MAC.

void syn_hmac_sha384_final (
    SYN_HMAC_SHA384 * ctx,
    uint8_t mac
) 

Parameters:

  • ctx HMAC-SHA384 context.
  • mac Output 48-byte MAC buffer.

function syn_hmac_sha384_init

Initialize HMAC-SHA384 context with a key.

void syn_hmac_sha384_init (
    SYN_HMAC_SHA384 * ctx,
    const void * key,
    size_t key_len
) 

Parameters:

  • ctx HMAC-SHA384 context.
  • key Secret key buffer.
  • key_len Secret key length in bytes.

function syn_hmac_sha384_update

Feed data chunk into HMAC-SHA384 computation.

void syn_hmac_sha384_update (
    SYN_HMAC_SHA384 * ctx,
    const void * data,
    size_t len
) 

Parameters:

  • ctx HMAC-SHA384 context.
  • data Data buffer to authenticate.
  • len Length in bytes.

function syn_hmac_sha512

Compute HMAC-SHA512 over data using secret key (RFC 4231).

void syn_hmac_sha512 (
    const void * key,
    size_t key_len,
    const void * data,
    size_t data_len,
    uint8_t mac
) 

Parameters:

  • key Secret key buffer.
  • key_len Secret key length in bytes.
  • data Data buffer to authenticate.
  • data_len Data length in bytes.
  • mac Output 64-byte MAC buffer.

function syn_hmac_sha512_final

Finalize HMAC-SHA512 computation and retrieve 64-byte MAC.

void syn_hmac_sha512_final (
    SYN_HMAC_SHA512 * ctx,
    uint8_t mac
) 

Parameters:

  • ctx HMAC-SHA512 context.
  • mac Output 64-byte MAC buffer.

function syn_hmac_sha512_init

Initialize HMAC-SHA512 context with a key.

void syn_hmac_sha512_init (
    SYN_HMAC_SHA512 * ctx,
    const void * key,
    size_t key_len
) 

Parameters:

  • ctx HMAC-SHA512 context.
  • key Secret key buffer.
  • key_len Secret key length in bytes.

function syn_hmac_sha512_update

Feed data chunk into HMAC-SHA512 computation.

void syn_hmac_sha512_update (
    SYN_HMAC_SHA512 * ctx,
    const void * data,
    size_t len
) 

Parameters:

  • ctx HMAC-SHA512 context.
  • data Data buffer to authenticate.
  • len Length in bytes.

function syn_sha384

One-shot SHA-384 calculation.

void syn_sha384 (
    const void * data,
    size_t len,
    uint8_t hash
) 

Parameters:

  • data Data to hash.
  • len Length in bytes.
  • hash Output 48-byte digest buffer.

function syn_sha384_final

Finalize SHA-384 hash and produce 48-byte digest.

void syn_sha384_final (
    SYN_SHA512 * ctx,
    uint8_t hash
) 

Parameters:

  • ctx SHA-512 context initialized with syn_sha384_init().
  • hash Output buffer (must be at least 48 bytes).

function syn_sha384_init

Initialize context for SHA-384 hashing.

void syn_sha384_init (
    SYN_SHA512 * ctx
) 

Parameters:

  • ctx Context to initialize.

function syn_sha512

One-shot SHA-512 calculation.

void syn_sha512 (
    const void * data,
    size_t len,
    uint8_t hash
) 

Parameters:

  • data Data to hash.
  • len Length in bytes.
  • hash Output 64-byte digest buffer.

function syn_sha512_final

Finalize SHA-512 hash and produce 64-byte digest.

void syn_sha512_final (
    SYN_SHA512 * ctx,
    uint8_t hash
) 

Parameters:

  • ctx SHA-512 context.
  • hash Output buffer (must be at least 64 bytes).

function syn_sha512_init

Initialize context for SHA-512 hashing.

void syn_sha512_init (
    SYN_SHA512 * ctx
) 

Parameters:

  • ctx Context to initialize.

function syn_sha512_update

Feed data into the SHA-512 / SHA-384 hash.

void syn_sha512_update (
    SYN_SHA512 * ctx,
    const void * data,
    size_t len
) 

Parameters:

  • ctx SHA-512 context.
  • data Data buffer to hash.
  • len Length in bytes.


The documentation for this class was generated from the following file src/syntropic/crypto/syn_sha512.c