Crypto::HashContext< Engine_ > Class Template Reference

Class template for a Hash implementation 'Context'. More...

#include <HashContext.h>

Inheritance diagram for Crypto::HashContext< Engine_ >:

Classes

struct  State
 

Public Types

using Engine = Engine_
 
using Hash = ByteArray< Engine::hashsize >
 

Public Member Functions

template<typename... EngineArgs>
 HashContext (EngineArgs &&... engineArgs)
 
template<typename... EngineArgs>
HashContextreset (EngineArgs &&... engineArgs)
 Reset the context for a new calculation. More...
 
template<typename... Ts>
Hash calculate (Ts &&... args)
 Calculate hash on some data. More...
 
Hash getHash ()
 Finalise and return the final hash value. More...
 
State getState ()
 Get intermediate hash state. More...
 
void setState (const State &state)
 Restore intermediate hash state. More...
 
Update hash over a given block of data
HashContextupdate (const Blob &blob)
 Data from Blob. More...
 
HashContextupdate (const FSTR::ObjectBase &obj)
 Data from flash object. More...
 
HashContextupdate (const void *data, size_t size)
 Pointer to data + size. More...
 
template<size_t size_>
HashContextupdate (const ByteArray< size_ > &array)
 Data in ByteArray. More...
 

Detailed Description

template<class Engine_>
class Crypto::HashContext< Engine_ >

Class template for a Hash implementation 'Context'.

Template Parameters
EngineThe HashEngine implementation

Member Typedef Documentation

◆ Engine

template<class Engine_ >
using Crypto::HashContext< Engine_ >::Engine = Engine_

◆ Hash

template<class Engine_ >
using Crypto::HashContext< Engine_ >::Hash = ByteArray<Engine::hashsize>

Constructor & Destructor Documentation

◆ HashContext()

template<class Engine_ >
template<typename... EngineArgs>
Crypto::HashContext< Engine_ >::HashContext ( EngineArgs &&...  engineArgs)
inline

Member Function Documentation

◆ calculate()

template<class Engine_ >
template<typename... Ts>
Hash Crypto::HashContext< Engine_ >::calculate ( Ts &&...  args)
inline

Calculate hash on some data.

Parameters
argsSee update() methods
Return values
Hash

◆ getHash()

template<class Engine_ >
Hash Crypto::HashContext< Engine_ >::getHash ( )
inline

Finalise and return the final hash value.

Return values
Hash

◆ getState()

template<class Engine_ >
State Crypto::HashContext< Engine_ >::getState ( )
inline

Get intermediate hash state.

Parameters
stateOUT: current state
Return values
uint64_tNumber of bytes processed so far
Note
This method is only required for core hashes, used by Bear SSL

◆ reset()

template<class Engine_ >
template<typename... EngineArgs>
HashContext& Crypto::HashContext< Engine_ >::reset ( EngineArgs &&...  engineArgs)
inline

Reset the context for a new calculation.

◆ setState()

template<class Engine_ >
void Crypto::HashContext< Engine_ >::setState ( const State state)
inline

Restore intermediate hash state.

Parameter values obtained via previous getState() call

Parameters
state
count
Note
This method is only required for core hashes, used by Bear SSL

◆ update() [1/4]

template<class Engine_ >
HashContext& Crypto::HashContext< Engine_ >::update ( const Blob blob)
inline

Data from Blob.

◆ update() [2/4]

template<class Engine_ >
template<size_t size_>
HashContext& Crypto::HashContext< Engine_ >::update ( const ByteArray< size_ > &  array)
inline

Data in ByteArray.

◆ update() [3/4]

template<class Engine_ >
HashContext& Crypto::HashContext< Engine_ >::update ( const FSTR::ObjectBase obj)
inline

Data from flash object.

◆ update() [4/4]

template<class Engine_ >
HashContext& Crypto::HashContext< Engine_ >::update ( const void *  data,
size_t  size 
)
inline

Pointer to data + size.

Parameters
dataData block
sizeLength of data in bytes

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