Files
wolfssl/doc/dox_comments/header_files/sha512.h

184 lines
4.1 KiB
C
Raw Normal View History

/*!
\ingroup SHA
2018-06-27 16:22:12 -06:00
\brief This function initializes SHA512. This is automatically called
by wc_Sha512Hash.
2018-06-27 16:22:12 -06:00
\return 0 Returned upon successfully initializing
2018-06-27 16:22:12 -06:00
\param sha512 pointer to the sha512 structure to use for encryption
2018-06-27 16:22:12 -06:00
_Example_
\code
Sha512 sha512[1];
if ((ret = wc_InitSha512(sha512)) != 0) {
WOLFSSL_MSG("wc_InitSha512 failed");
}
else {
wc_Sha512Update(sha512, data, len);
wc_Sha512Final(sha512, hash);
}
\endcode
2018-06-27 16:22:12 -06:00
\sa wc_Sha512Hash
\sa wc_Sha512Update
\sa wc_Sha512Final
*/
int wc_InitSha512(wc_Sha512*);
/*!
\ingroup SHA
2018-06-27 16:22:12 -06:00
\brief Can be called to continually hash the provided byte array
of length len.
2018-06-27 16:22:12 -06:00
\return 0 Returned upon successfully adding the data to the digest.
2018-06-27 16:22:12 -06:00
\param sha512 pointer to the sha512 structure to use for encryption
\param data the data to be hashed
\param len length of data to be hashed
2018-06-27 16:22:12 -06:00
_Example_
\code
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);
}
2018-06-27 16:22:12 -06:00
\endcode
\sa wc_Sha512Hash
\sa wc_Sha512Final
\sa wc_InitSha512
*/
int wc_Sha512Update(wc_Sha512* sha, const byte* data, word32 len);
/*!
\ingroup SHA
2018-06-27 16:22:12 -06:00
\brief Finalizes hashing of data. Result is placed into hash.
2018-06-27 16:22:12 -06:00
\return 0 Returned upon successfully finalizing the hash.
2018-06-27 16:22:12 -06:00
\param sha512 pointer to the sha512 structure to use for encryption
\param hash Byte array to hold hash value.
2018-06-27 16:22:12 -06:00
_Example_
\code
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);
}
\endcode
2018-06-27 16:22:12 -06:00
\sa wc_Sha512Hash
\sa wc_Sha512Final
\sa wc_InitSha512
*/
int wc_Sha512Final(wc_Sha512* sha512, byte* hash);
/*!
\ingroup SHA
2018-06-27 16:22:12 -06:00
\brief This function initializes SHA384. This is automatically called
by wc_Sha384Hash.
2018-06-27 16:22:12 -06:00
\return 0 Returned upon successfully initializing
2018-06-27 16:22:12 -06:00
\param sha384 pointer to the sha384 structure to use for encryption
2018-06-27 16:22:12 -06:00
_Example_
\code
Sha384 sha384[1];
if ((ret = wc_InitSha384(sha384)) != 0) {
WOLFSSL_MSG("wc_InitSha384 failed");
}
else {
wc_Sha384Update(sha384, data, len);
wc_Sha384Final(sha384, hash);
}
\endcode
2018-06-27 16:22:12 -06:00
\sa wc_Sha384Hash
\sa wc_Sha384Update
\sa wc_Sha384Final
*/
int wc_InitSha384(wc_Sha384*);
/*!
\ingroup SHA
2018-06-27 16:22:12 -06:00
\brief Can be called to continually hash the provided byte array
of length len.
2018-06-27 16:22:12 -06:00
\return 0 Returned upon successfully adding the data to the digest.
2018-06-27 16:22:12 -06:00
\param sha384 pointer to the sha384 structure to use for encryption
\param data the data to be hashed
\param len length of data to be hashed
_Example_
\code
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);
}
\endcode
2018-06-27 16:22:12 -06:00
\sa wc_Sha384Hash
\sa wc_Sha384Final
\sa wc_InitSha384
*/
int wc_Sha384Update(wc_Sha384* sha, const byte* data, word32 len);
/*!
\ingroup SHA
2018-06-27 16:22:12 -06:00
\brief Finalizes hashing of data. Result is placed into hash.
2018-06-27 16:22:12 -06:00
\return 0 Returned upon successfully finalizing.
2018-06-27 16:22:12 -06:00
\param sha384 pointer to the sha384 structure to use for encryption
\param hash Byte array to hold hash value.
2018-06-27 16:22:12 -06:00
_Example_
\code
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);
}
\endcode
2018-06-27 16:22:12 -06:00
\sa wc_Sha384Hash
\sa wc_Sha384Final
\sa wc_InitSha384
*/
int wc_Sha384Final(wc_Sha384* sha384, byte* hash);