Skip to content

sha512.h

Functions

Name
int wc_InitSha512(wc_Sha512 * )
This function initializes SHA512. This is automatically called by wc_Sha512Hash.
int wc_Sha512Update(wc_Sha512 * sha, const byte * data, word32 len)
Can be called to continually hash the provided byte array of length len.
int wc_Sha512Final(wc_Sha512 * sha512, byte * hash)
Finalizes hashing of data. Result is placed into hash.
int wc_InitSha384(wc_Sha384 * )
This function initializes SHA384. This is automatically called by wc_Sha384Hash.
int wc_Sha384Update(wc_Sha384 * sha, const byte * data, word32 len)
Can be called to continually hash the provided byte array of length len.
int wc_Sha384Final(wc_Sha384 * sha384, byte * hash)
Finalizes hashing of data. Result is placed into hash.

Functions Documentation

function wc_InitSha512

int wc_InitSha512(
    wc_Sha512 * 
)

This function initializes SHA512. This is automatically called by wc_Sha512Hash.

Parameters:

  • sha512 pointer to the sha512 structure to use for encryption

See:

Return: 0 Returned upon successfully initializing

Example

Sha512 sha512[1];
if ((ret = wc_InitSha512(sha512)) != 0) {
   WOLFSSL_MSG("wc_InitSha512 failed");
}
else {
   wc_Sha512Update(sha512, data, len);
   wc_Sha512Final(sha512, hash);
}

function wc_Sha512Update

int wc_Sha512Update(
    wc_Sha512 * sha,
    const byte * data,
    word32 len
)

Can be called to continually hash the provided byte array of length len.

Parameters:

  • sha512 pointer to the sha512 structure to use for encryption
  • data the data to be hashed
  • len length of data to be hashed

See:

Return: 0 Returned upon successfully adding the data to the digest.

Example

Sha512 sha512[1];
byte data[] = { Data to be hashed };
word32 len = sizeof(data);

if ((ret = wc_InitSha512(sha512)) != 0) {
   WOLFSSL_MSG("wc_InitSha512 failed");
}
else {
   wc_Sha512Update(sha512, data, len);
   wc_Sha512Final(sha512, hash);
}

function wc_Sha512Final

int wc_Sha512Final(
    wc_Sha512 * sha512,
    byte * hash
)

Finalizes hashing of data. Result is placed into hash.

Parameters:

  • sha512 pointer to the sha512 structure to use for encryption
  • hash Byte array to hold hash value.

See:

Return: 0 Returned upon successfully finalizing the hash.

Example

Sha512 sha512[1];
byte data[] = { Data to be hashed };
word32 len = sizeof(data);

if ((ret = wc_InitSha512(sha512)) != 0) {
    WOLFSSL_MSG("wc_InitSha512 failed");
}
else {
   wc_Sha512Update(sha512, data, len);
   wc_Sha512Final(sha512, hash);
}

function wc_InitSha384

int wc_InitSha384(
    wc_Sha384 * 
)

This function initializes SHA384. This is automatically called by wc_Sha384Hash.

Parameters:

  • sha384 pointer to the sha384 structure to use for encryption

See:

Return: 0 Returned upon successfully initializing

Example

Sha384 sha384[1];
if ((ret = wc_InitSha384(sha384)) != 0) {
   WOLFSSL_MSG("wc_InitSha384 failed");
}
else {
   wc_Sha384Update(sha384, data, len);
   wc_Sha384Final(sha384, hash);
}

function wc_Sha384Update

int wc_Sha384Update(
    wc_Sha384 * sha,
    const byte * data,
    word32 len
)

Can be called to continually hash the provided byte array of length len.

Parameters:

  • sha384 pointer to the sha384 structure to use for encryption
  • data the data to be hashed
  • len length of data to be hashed

See:

Return: 0 Returned upon successfully adding the data to the digest.

Example

Sha384 sha384[1];
byte data[] = { Data to be hashed };
word32 len = sizeof(data);

if ((ret = wc_InitSha384(sha384)) != 0) {
   WOLFSSL_MSG("wc_InitSha384 failed");
}
else {
   wc_Sha384Update(sha384, data, len);
   wc_Sha384Final(sha384, hash);
}

function wc_Sha384Final

int wc_Sha384Final(
    wc_Sha384 * sha384,
    byte * hash
)

Finalizes hashing of data. Result is placed into hash.

Parameters:

  • sha384 pointer to the sha384 structure to use for encryption
  • hash Byte array to hold hash value.

See:

Return: 0 Returned upon successfully finalizing.

Example

Sha384 sha384[1];
byte data[] = { Data to be hashed };
word32 len = sizeof(data);

if ((ret = wc_InitSha384(sha384)) != 0) {
   WOLFSSL_MSG("wc_InitSha384 failed");
}
else {
   wc_Sha384Update(sha384, data, len);
   wc_Sha384Final(sha384, hash);
}

Source code


int wc_InitSha512(wc_Sha512*);

int wc_Sha512Update(wc_Sha512* sha, const byte* data, word32 len);

int wc_Sha512Final(wc_Sha512* sha512, byte* hash);

int wc_InitSha384(wc_Sha384*);

int wc_Sha384Update(wc_Sha384* sha, const byte* data, word32 len);

int wc_Sha384Final(wc_Sha384* sha384, byte* hash);

Updated on 2024-03-19 at 01:20:40 +0000