AnCH Framework 0.1
Another C++ Hack Framework
 
Loading...
Searching...
No Matches
anch::crypto::SHA2< O, B, W, R, I > Class Template Referenceabstract

SHA2 abstract class. More...

#include <sha2.hpp>

+ Inheritance diagram for anch::crypto::SHA2< O, B, W, R, I >:
+ Collaboration diagram for anch::crypto::SHA2< O, B, W, R, I >:

Classes

union  Chunk
 
struct  Context
 

Public Member Functions

 SHA2 ()
 
virtual ~SHA2 ()
 
virtual const std::array< uint8_t, O > & digest () const override
 
- Public Member Functions inherited from anch::crypto::Hash< O, B >
const std::array< uint8_t, O > & digest (const std::string &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)
 
const std::array< uint8_t, O > & digest (std::istream &stream)
 

Static Protected Member Functions

static constexpr W shiftRight (uint8_t bits, W word)
 
static constexpr W rotateLeft (uint8_t bits, W word)
 
static constexpr W rotateRight (uint8_t bits, W word)
 

Protected Attributes

Context< I > _context
 
- Protected Attributes inherited from anch::crypto::Hash< O, B >
std::array< uint8_t, O > * _digest
 

Additional Inherited Members

- Static Public Member Functions inherited from anch::crypto::Hash< O, B >
static constexpr std::size_t getOutputSize ()
 
static constexpr std::size_t getBlockSize ()
 

Detailed Description

template<std::size_t O, std::size_t B, typename W, uint32_t R, const std::array< W, 8 > & I>
class anch::crypto::SHA2< O, B, W, R, I >

SHA2 abstract class.

SHA2 contains algorithms for SHA224/256/384/512.
The children have to define the translation array and the sigma transformation functions.
The template parameters are:

  • O: the output size in byte
  • B: the treatment block size in byte
  • W: the word type (32 bits or 64 bits)
  • R: the number of round for each chunk
  • I: the initial state

SHA224/256/384/512 are implemented in this library.

Since
0.1
Author
Vincent Lachenal

Constructor & Destructor Documentation

◆ SHA2()

template<std::size_t O, std::size_t B, typename W, uint32_t R, const std::array< W, 8 > & I>
anch::crypto::SHA2< O, B, W, R, I >::SHA2 ( )

SHA2 default constructor

◆ ~SHA2()

template<std::size_t O, std::size_t B, typename W, uint32_t R, const std::array< W, 8 > & I>
virtual anch::crypto::SHA2< O, B, W, R, I >::~SHA2 ( )
virtual

SHA2 destructor

Member Function Documentation

◆ digest()

template<std::size_t O, std::size_t B, typename W, uint32_t R, const std::array< W, 8 > & I>
virtual const std::array< uint8_t, O > & anch::crypto::SHA2< O, B, W, R, I >::digest ( ) const
overridevirtual

Get the SHA2 hash result

Returns
the SHA2 hash result

Implements anch::crypto::Hash< O, B >.

◆ rotateLeft()

template<std::size_t O, std::size_t B, typename W, uint32_t R, const std::array< W, 8 > & I>
static constexpr W anch::crypto::SHA2< O, B, W, R, I >::rotateLeft ( uint8_t bits,
W word )
inlinestaticconstexprprotected

Rotate n bits word from n bits to left

Parameters
bitsthe number of bits to rotate
wordthe n bits word to rotate

◆ rotateRight()

template<std::size_t O, std::size_t B, typename W, uint32_t R, const std::array< W, 8 > & I>
static constexpr W anch::crypto::SHA2< O, B, W, R, I >::rotateRight ( uint8_t bits,
W word )
inlinestaticconstexprprotected

Rotate n bits word from n bits to right

Parameters
bitsthe number of bits to rotate
wordthe n bits word to rotate

◆ shiftRight()

template<std::size_t O, std::size_t B, typename W, uint32_t R, const std::array< W, 8 > & I>
static constexpr W anch::crypto::SHA2< O, B, W, R, I >::shiftRight ( uint8_t bits,
W word )
inlinestaticconstexprprotected

Shift n bits word from n bits to right

Parameters
bitsthe number of bits to shift
wordthe n bits word to shift

Member Data Documentation

◆ _context

template<std::size_t O, std::size_t B, typename W, uint32_t R, const std::array< W, 8 > & I>
Context<I> anch::crypto::SHA2< O, B, W, R, I >::_context
protected

SHA2 context


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