SHA-256 hash function class. More...

#include <sha256.h>

Public Member Functions

virtual void add (const void *data, int size)=0
 Adds data to be hashed. More...
 
virtual void add (const DataBufferPtr &data)=0
 Add. More...
 
virtual void calculate ()=0
 Finalize hash calculation. More...
 
virtual std::string hash (bool uppercase=false) const =0
 Returns the calculated hash. More...
 
virtual void hash (unsigned char out_hash[hash_size]) const =0
 Get hash. More...
 
virtual void reset ()=0
 Resets the hash generator. More...
 
virtual void set_hmac (const void *key_data, int key_size)=0
 Enable a HMAC based calculation. More...
 

Static Public Member Functions

static std::shared_ptr< SHA256create ()
 Constructs a SHA-256 hash generator. More...
 

Static Public Attributes

static const int hash_size = 32
 

Detailed Description

SHA-256 hash function class.

Member Function Documentation

virtual void uicore::SHA256::add ( const void *  data,
int  size 
)
pure virtual

Adds data to be hashed.

virtual void uicore::SHA256::add ( const DataBufferPtr data)
pure virtual

Add.

Parameters
data= Data Buffer
virtual void uicore::SHA256::calculate ( )
pure virtual

Finalize hash calculation.

static std::shared_ptr<SHA256> uicore::SHA256::create ( )
static

Constructs a SHA-256 hash generator.

virtual std::string uicore::SHA256::hash ( bool  uppercase = false) const
pure virtual

Returns the calculated hash.

virtual void uicore::SHA256::hash ( unsigned char  out_hash[hash_size]) const
pure virtual

Get hash.

Parameters
out_hash= where to write to
virtual void uicore::SHA256::reset ( )
pure virtual

Resets the hash generator.

virtual void uicore::SHA256::set_hmac ( const void *  key_data,
int  key_size 
)
pure virtual

Enable a HMAC based calculation.

Call this function before the initial add(). It is reset by reset()

Parameters
key_data= The HMAC key
key_size= The size of the key_data

Member Data Documentation

const int uicore::SHA256::hash_size = 32
static

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