23 #ifndef ICL_CORE_CRYPT_SHA2_H_INCLUDED 24 #define ICL_CORE_CRYPT_SHA2_H_INCLUDED 65 template <
typename T, T t_h0, T t_h1, T t_h2, T t_h3, T t_h4, T t_h5, T t_h6, T t_h7,
size_t t_len>
66 class Sha2 :
public Sha2Impl<T, t_h0, t_h1, t_h2, t_h3, t_h4, t_h5, t_h6, t_h7, t_len>
82 {
return process(data.c_str(), data.size()); }
112 0xc1059ed8ul, 0x367cd507ul, 0x3070dd17ul, 0xf70e5939ul,
113 0xffc00b31ul, 0x68581511ul, 0x64f98fa7ul, 0xbefa4fa4ul, 7>
Sha224;
116 0x6a09e667ul, 0xbb67ae85ul, 0x3c6ef372ul, 0xa54ff53aul,
117 0x510e527ful, 0x9b05688cul, 0x1f83d9abul, 0x5be0cd19ul, 8>
Sha256;
120 0xcbbb9d5dc1059ed8ull, 0x629a292a367cd507ull, 0x9159015a3070dd17ull, 0x152fecd8f70e5939ull,
121 0x67332667ffc00b31ull, 0x8eb44a8768581511ull, 0xdb0c2e0d64f98fa7ull, 0x47b5481dbefa4fa4ull, 6>
Sha384;
124 0x6a09e667f3bcc908ull, 0xbb67ae8584caa73bull, 0x3c6ef372fe94f82bull, 0xa54ff53a5f1d36f1ull,
125 0x510e527fade682d1ull, 0x9b05688c2b3e6c1full, 0x1f83d9abfb41bd6bull, 0x5be0cd19137e2179ull, 8>
Sha512;
void finalizeBuffer(size_t size)
Sha2()
Initializes the internal state.
Sha2 & process(const ::icl_core::String &data)
Processes the string data.
uint8_t m_buffer[cMESSAGE_BLOCK_SIZE]
::icl_core::String getHexDigest() const
Returns the message digest as a hex string.
T m_digest[8]
The whole message digest.
Sha2Impl< T, t_h0, t_h1, t_h2, t_h3, t_h4, t_h5, t_h6, t_h7, t_len > Impl
Sha2< uint32_t, 0xc1059ed8ul, 0x367cd507ul, 0x3070dd17ul, 0xf70e5939ul, 0xffc00b31ul, 0x68581511ul, 0x64f98fa7ul, 0xbefa4fa4ul, 7 > Sha224
The SHA-224 hash algorithm.
uint64_t m_message_size
The size of the message so far, in bytes.
Sha2 & finalize()
Finalizes the message digest.
size_t m_buffer_fill
The amount of bytes currently stored in the internal buffer.
Sha2< uint64_t, 0x6a09e667f3bcc908ull, 0xbb67ae8584caa73bull, 0x3c6ef372fe94f82bull, 0xa54ff53a5f1d36f1ull, 0x510e527fade682d1ull, 0x9b05688c2b3e6c1full, 0x1f83d9abfb41bd6bull, 0x5be0cd19137e2179ull, 8 > Sha512
The SHA-512 hash algorithm.
Sha2< uint32_t, 0x6a09e667ul, 0xbb67ae85ul, 0x3c6ef372ul, 0xa54ff53aul, 0x510e527ful, 0x9b05688cul, 0x1f83d9abul, 0x5be0cd19ul, 8 > Sha256
The SHA-256 hash algorithm.
unsigned __int64 uint64_t
Sha2 & process(const char *data)
Processes the string data.
static const size_t cMESSAGE_BLOCK_SIZE
The message block size in bytes.
void clear()
Clears the internal state. A new hash can then be calculated.
Contains Interface base classes and base types.
static const size_t cMESSAGE_PAD_POSITION
Sha2< uint64_t, 0xcbbb9d5dc1059ed8ull, 0x629a292a367cd507ull, 0x9159015a3070dd17ull, 0x152fecd8f70e5939ull, 0x67332667ffc00b31ull, 0x8eb44a8768581511ull, 0xdb0c2e0d64f98fa7ull, 0x47b5481dbefa4fa4ull, 6 > Sha384
The SHA-384 hash algorithm.