Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes
icl_core::crypt::Sha2Impl< T, t_h0, t_h1, t_h2, t_h3, t_h4, t_h5, t_h6, t_h7, t_len > Class Template Reference

#include <Sha2Impl.h>

Inheritance diagram for icl_core::crypt::Sha2Impl< T, t_h0, t_h1, t_h2, t_h3, t_h4, t_h5, t_h6, t_h7, t_len >:
Inheritance graph
[legend]

List of all members.

Public Member Functions

void clear ()
 Clears the internal state. A new hash can then be calculated.
::icl_core::String getHexDigest () const
 Returns the message digest as a hex string.
 Sha2Impl ()
 Initializes the internal state.

Static Public Attributes

static const size_t cMESSAGE_BLOCK_SIZE = 64
 The message block size in bytes.
static const size_t cMESSAGE_PAD_POSITION = 56

Protected Member Functions

void processBuffer ()

Protected Attributes

uint8_t m_buffer [cMESSAGE_BLOCK_SIZE]
size_t m_buffer_fill
 The amount of bytes currently stored in the internal buffer.
m_digest [8]
 The whole message digest.
uint64_t m_message_size
 The size of the message so far, in bytes.

Detailed Description

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>
class icl_core::crypt::Sha2Impl< T, t_h0, t_h1, t_h2, t_h3, t_h4, t_h5, t_h6, t_h7, t_len >

The implementation internals for SHA-2, following the FIPS PUB 180-3 Secure Hash Standard (SHS). The implementation works for 32-bit (SHA-224, SHA-256) and 64-bit (SHA-384, SHA-512) data types. The algorithmic differences in the 64-bit version are captured by a template specialization.

Template Parameters:
TThe type of the message words (uint32_t or uint64_t).
t_h0The initial hash value, word 0.
t_h1The initial hash value, word 1.
t_h2The initial hash value, word 2.
t_h3The initial hash value, word 3.
t_h4The initial hash value, word 4.
t_h5The initial hash value, word 5.
t_h6The initial hash value, word 6.
t_h7The initial hash value, word 7.
t_lenThe 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.

Definition at line 52 of file Sha2Impl.h.


Constructor & Destructor Documentation

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>
icl_core::crypt::Sha2Impl< T, t_h0, t_h1, t_h2, t_h3, t_h4, t_h5, t_h6, t_h7, t_len >::Sha2Impl ( )

Initializes the internal state.


Member Function Documentation

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>
void icl_core::crypt::Sha2Impl< T, t_h0, t_h1, t_h2, t_h3, t_h4, t_h5, t_h6, t_h7, t_len >::clear ( )

Clears the internal state. A new hash can then be calculated.

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>
::icl_core::String icl_core::crypt::Sha2Impl< T, t_h0, t_h1, t_h2, t_h3, t_h4, t_h5, t_h6, t_h7, t_len >::getHexDigest ( ) const

Returns the message digest as a hex string.

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>
void icl_core::crypt::Sha2Impl< T, t_h0, t_h1, t_h2, t_h3, t_h4, t_h5, t_h6, t_h7, t_len >::processBuffer ( ) [protected]

Processes the current buffer contents and adds them to the message digest.


Member Data Documentation

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>
const size_t icl_core::crypt::Sha2Impl< T, t_h0, t_h1, t_h2, t_h3, t_h4, t_h5, t_h6, t_h7, t_len >::cMESSAGE_BLOCK_SIZE = 64 [static]

The message block size in bytes.

Definition at line 56 of file Sha2Impl.h.

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>
const size_t icl_core::crypt::Sha2Impl< T, t_h0, t_h1, t_h2, t_h3, t_h4, t_h5, t_h6, t_h7, t_len >::cMESSAGE_PAD_POSITION = 56 [static]

The position up to which the last block is padded (the remaining bytes hold the message length).

Definition at line 60 of file Sha2Impl.h.

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>
uint8_t icl_core::crypt::Sha2Impl< T, t_h0, t_h1, t_h2, t_h3, t_h4, t_h5, t_h6, t_h7, t_len >::m_buffer[cMESSAGE_BLOCK_SIZE] [protected]

The internal message buffer. Stores the data for one message block.

Definition at line 84 of file Sha2Impl.h.

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>
size_t icl_core::crypt::Sha2Impl< T, t_h0, t_h1, t_h2, t_h3, t_h4, t_h5, t_h6, t_h7, t_len >::m_buffer_fill [protected]

The amount of bytes currently stored in the internal buffer.

Definition at line 86 of file Sha2Impl.h.

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>
T icl_core::crypt::Sha2Impl< T, t_h0, t_h1, t_h2, t_h3, t_h4, t_h5, t_h6, t_h7, t_len >::m_digest[8] [protected]

The whole message digest.

Definition at line 78 of file Sha2Impl.h.

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>
uint64_t icl_core::crypt::Sha2Impl< T, t_h0, t_h1, t_h2, t_h3, t_h4, t_h5, t_h6, t_h7, t_len >::m_message_size [protected]

The size of the message so far, in bytes.

Definition at line 80 of file Sha2Impl.h.


The documentation for this class was generated from the following file:


fzi_icl_core
Author(s):
autogenerated on Thu Jun 6 2019 20:22:26