AnCH Framework  0.1
Another C++ Hack Framework
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
anch::crypto::Hash< O, B > Class Template Referenceabstract

Hash algorithm abstract class. More...

#include <hash.hpp>

Inheritance diagram for anch::crypto::Hash< O, B >:
Collaboration diagram for anch::crypto::Hash< O, B >:

Public Member Functions

virtual const std::array< uint8_t, O > & digest () const =0
 
template<class CharT , class Traits , class Allocator >
const std::array< uint8_t, O > & digest (const std::basic_string< CharT, Traits, Allocator > &data)
 
template<std::size_t N>
const std::array< uint8_t, O > & digest (const std::array< uint8_t, N > &data)
 
const std::array< uint8_t, O > & digest (const uint8_t *data, std::size_t len)
 
template<class CharT , class Traits >
const std::array< uint8_t, O > & digest (std::basic_istream< CharT, Traits > &stream)
 

Static Public Member Functions

static constexpr std::size_t getOutputSize ()
 
static constexpr std::size_t getBlockSize ()
 

Protected Member Functions

virtual void reset ()=0
 
virtual void addData (const uint8_t *data, std::size_t len)=0
 
virtual void finalize ()=0
 

Detailed Description

template<std::size_t O, std::size_t B>
class anch::crypto::Hash< O, B >

Hash algorithm abstract class.

N is the hash output size in bytes.
B is the hash block size in bytes (used in HMAC algorithm).

Author
Vincent Lachenal

Member Function Documentation

template<std::size_t O, std::size_t B>
virtual void anch::crypto::Hash< O, B >::addData ( const uint8_t *  data,
std::size_t  len 
)
protectedpure virtual

Compute hash for data with the current hash

Parameters
dataThe data to add
lenThe data length

Implemented in anch::crypto::SHA1, and anch::crypto::MD5.

template<std::size_t O, std::size_t B>
virtual const std::array<uint8_t,O>& anch::crypto::Hash< O, B >::digest ( ) const
pure virtual
template<std::size_t O, std::size_t B>
template<class CharT , class Traits , class Allocator >
const std::array<uint8_t,O>& anch::crypto::Hash< O, B >::digest ( const std::basic_string< CharT, Traits, Allocator > &  data)
inline

Reset current hash context and compute hash for string

Parameters
datathe string to hash
Returns
the hash result
template<std::size_t O, std::size_t B>
template<std::size_t N>
const std::array<uint8_t,O>& anch::crypto::Hash< O, B >::digest ( const std::array< uint8_t, N > &  data)
inline

Reset current hash context and compute hash for string

Parameters
datathe string to hash
Returns
the hash result
template<std::size_t O, std::size_t B>
const std::array<uint8_t,O>& anch::crypto::Hash< O, B >::digest ( const uint8_t *  data,
std::size_t  len 
)
inline

Reset current hash context and compute hash for string

Parameters
datathe string to hash
lenthe data length
Returns
the hash result
template<std::size_t O, std::size_t B>
template<class CharT , class Traits >
const std::array<uint8_t,O>& anch::crypto::Hash< O, B >::digest ( std::basic_istream< CharT, Traits > &  stream)
inline

Reset current hash context and compute hash for stream

Parameters
streamthe stream to hash
Returns
the hash result
template<std::size_t O, std::size_t B>
virtual void anch::crypto::Hash< O, B >::finalize ( )
protectedpure virtual

Reset hash context

Implemented in anch::crypto::SHA1, and anch::crypto::MD5.

template<std::size_t O, std::size_t B>
static constexpr std::size_t anch::crypto::Hash< O, B >::getBlockSize ( )
inlinestatic

Hash block size getter

Returns
the block size
template<std::size_t O, std::size_t B>
static constexpr std::size_t anch::crypto::Hash< O, B >::getOutputSize ( )
inlinestatic

Hash output size getter

Returns
the output size
template<std::size_t O, std::size_t B>
virtual void anch::crypto::Hash< O, B >::reset ( )
protectedpure virtual

Reset hash context

Implemented in anch::crypto::SHA1, and anch::crypto::MD5.


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