#include <Sha2.h>
Public Types | |
typedef Sha2Impl< T, t_h0, t_h1, t_h2, t_h3, t_h4, t_h5, t_h6, t_h7, t_len > | Impl |
Public Member Functions | |
Sha2 & | finalize () |
Finalizes the message digest. | |
Sha2 & | process (const char *data) |
Processes the string data. | |
Sha2 & | process (const ::icl_core::String &data) |
Processes the string data. | |
Sha2 & | process (const void *data, size_t size) |
Processes size bytes from the buffer data. | |
Sha2 () | |
Initializes the internal state. | |
Protected Member Functions | |
void | finalizeBuffer (size_t size) |
An implementation of SHA-2, following the FIPS PUB 180-3 Secure Hash Standard (SHS).
Instead of instantiating this manually, use the convenience typedefs Sha224, Sha256, Sha384 or Sha512 instead.
Usage example (using Sha256):
Sha256 sha; sha.process("An example string."); sha.process("More data for the same digest."); sha.finalize(); std::cout << sha.getHexDigest() << std::endl;
T | The type of the message words (uint32_t or uint64_t). |
t_h0 | The initial hash value, word 0. |
t_h1 | The initial hash value, word 1. |
t_h2 | The initial hash value, word 2. |
t_h3 | The initial hash value, word 3. |
t_h4 | The initial hash value, word 4. |
t_h5 | The initial hash value, word 5. |
t_h6 | The initial hash value, word 6. |
t_h7 | The initial hash value, word 7. |
t_len | The length, in words, of the message digest. This may be at most 8 (i.e., all eight words of the digest are used). Only the first t_len words of the digest are returned otherwise. |
typedef Sha2Impl<T, t_h0, t_h1, t_h2, t_h3, t_h4, t_h5, t_h6, t_h7, t_len> icl_core::crypt::Sha2< T, t_h0, t_h1, t_h2, t_h3, t_h4, t_h5, t_h6, t_h7, t_len >::Impl |
icl_core::crypt::Sha2< T, t_h0, t_h1, t_h2, t_h3, t_h4, t_h5, t_h6, t_h7, t_len >::Sha2 | ( | ) |
Initializes the internal state.
Sha2& icl_core::crypt::Sha2< T, t_h0, t_h1, t_h2, t_h3, t_h4, t_h5, t_h6, t_h7, t_len >::finalize | ( | ) |
Finalizes the message digest.
void icl_core::crypt::Sha2< T, t_h0, t_h1, t_h2, t_h3, t_h4, t_h5, t_h6, t_h7, t_len >::finalizeBuffer | ( | size_t | size | ) | [protected] |
Processes the first size bytes of the current buffer contents and finalizes the digest.
Sha2& icl_core::crypt::Sha2< T, t_h0, t_h1, t_h2, t_h3, t_h4, t_h5, t_h6, t_h7, t_len >::process | ( | const char * | data | ) |
Processes the string data.
Sha2& icl_core::crypt::Sha2< T, t_h0, t_h1, t_h2, t_h3, t_h4, t_h5, t_h6, t_h7, t_len >::process | ( | const ::icl_core::String & | data | ) | [inline] |
Sha2& icl_core::crypt::Sha2< T, t_h0, t_h1, t_h2, t_h3, t_h4, t_h5, t_h6, t_h7, t_len >::process | ( | const void * | data, |
size_t | size | ||
) |
Processes size bytes from the buffer data.