Public Types | Public Member Functions | Protected Member Functions | List of all members
icl_core::crypt::Sha2< T, t_h0, t_h1, t_h2, t_h3, t_h4, t_h5, t_h6, t_h7, t_len > Class Template Reference

#include <Sha2.h>

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

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

Sha2finalize ()
 Finalizes the message digest. More...
 
Sha2process (const char *data)
 Processes the string data. More...
 
Sha2process (const ::icl_core::String &data)
 Processes the string data. More...
 
Sha2process (const void *data, size_t size)
 Processes size bytes from the buffer data. More...
 
 Sha2 ()
 Initializes the internal state. More...
 
- Public Member Functions inherited from icl_core::crypt::Sha2Impl< T, t_h0, t_h1, t_h2, t_h3, t_h4, t_h5, t_h6, t_h7, t_len >
void clear ()
 Clears the internal state. A new hash can then be calculated. More...
 
::icl_core::String getHexDigest () const
 Returns the message digest as a hex string. More...
 
 Sha2Impl ()
 Initializes the internal state. More...
 

Protected Member Functions

void finalizeBuffer (size_t size)
 
- Protected Member Functions inherited from icl_core::crypt::Sha2Impl< T, t_h0, t_h1, t_h2, t_h3, t_h4, t_h5, t_h6, t_h7, t_len >
void processBuffer ()
 

Additional Inherited Members

- Static Public Attributes inherited from icl_core::crypt::Sha2Impl< T, t_h0, t_h1, t_h2, t_h3, t_h4, t_h5, t_h6, t_h7, t_len >
static const size_t cMESSAGE_BLOCK_SIZE = 64
 The message block size in bytes. More...
 
static const size_t cMESSAGE_PAD_POSITION = 56
 
- Protected Attributes inherited from icl_core::crypt::Sha2Impl< T, t_h0, t_h1, t_h2, t_h3, t_h4, t_h5, t_h6, t_h7, t_len >
uint8_t m_buffer [cMESSAGE_BLOCK_SIZE]
 
size_t m_buffer_fill
 The amount of bytes currently stored in the internal buffer. More...
 
m_digest [8]
 The whole message digest. More...
 
uint64_t m_message_size
 The size of the message so far, in bytes. More...
 

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

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;
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.
See also
Sha224, Sha256, Sha384, Sha512

Definition at line 66 of file Sha2.h.

Member Typedef 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>
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

Definition at line 69 of file Sha2.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::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.

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>
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.

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::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.

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>
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.

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>
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

Processes the string data.

Definition at line 81 of file Sha2.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>
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.


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


fzi_icl_core
Author(s):
autogenerated on Mon Jun 10 2019 13:17:59