libxcks  0.1.0.1
libxcks::AbstractSHA512Impl Class Referenceabstract

Computes the SHA512 hash from a byte stream. More...

#include <sha384_512.hpp>

Inheritance diagram for libxcks::AbstractSHA512Impl:
Collaboration diagram for libxcks::AbstractSHA512Impl:

Public Member Functions

void reset () override=0
 Resets the checksum to initial value. More...
 
void update (const uint8_t *buf, size_t len) override final
 Updates the SHA512 hash with specified array of bytes. More...
 
- Public Member Functions inherited from libxcks::ChecksumEx
std::string toString (const bool hexInUpperCase=false) const override
 Returns the hash value has a string. More...
 
- Public Member Functions inherited from libxcks::Checksum
virtual ~Checksum ()
 Destructor. More...
 
virtual uint8_t * getValue (uint8_t *buffer) const =0
 Returns the checksum value in the first bytes of the given address. More...
 
virtual size_t getSize () const =0
 Returns the minimal size to allocate in memory to store the checksum with the getValue(buffer) method. More...
 
virtual std::string getName () const =0
 Returns the name of the checksum or the hash algorithm. More...
 
virtual ArrayString getAltNames () const
 Returns the alternative name(s) of the checksum or the hash algorithm. More...
 
virtual ChecksumAlgoId getID () const =0
 Returns an unique identifier for the checksum or the hash algorithm. More...
 

Protected Member Functions

void finish ()
 Process the remaining bytes in the internal buffer and the usual prolog according to the standard. More...
 
void transform (uint8_t *data)
 Transform the message X which consists of 16 64-bit-words. More...
 

Protected Attributes

uint64_t h0
 First part of the state of computation. More...
 
uint64_t h1
 Second part of the state of computation. More...
 
uint64_t h2
 Third part of the state of computation. More...
 
uint64_t h3
 Fourth part of the state of computation. More...
 
uint64_t h4
 Fifth part of the state of computation. More...
 
uint64_t h5
 Sixth part of the state of computation. More...
 
uint64_t h6
 Seventh part of the state of computation. More...
 
uint64_t h7
 Eighth part of the state of computation. More...
 
uint64_t nblocks
 Number of blocks. More...
 
int count
 Current size of the input buffer. More...
 
uint8_t ibuffer [128]
 Input buffer. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from libxcks::Checksum
static ArrayString getAlternativeNames ()
 Returns the alternative name(s) of the checksum or the hash algorithm. More...
 
- Static Protected Member Functions inherited from libxcks::LibgcryptHash
static uint32_t rol (uint32_t x, int n)
 Rotate the 32 bit unsigned integer x by n bits left. More...
 
static uint32_t ror (uint32_t x, int n)
 Rotate the 32 bit unsigned integer x by n bits right. More...
 
- Static Protected Member Functions inherited from libxcks::ChecksumEx
static uint32_t swapOnLE (const uint32_t value)
 Swaps bytes on little endian architectures. More...
 
static uint32_t swapOnBE (const uint32_t value)
 Swaps bytes on big endian architectures. More...
 
static uint64_t swapOnLE (const uint64_t value)
 Swaps bytes on little endian architectures. More...
 
static uint64_t swapOnBE (const uint64_t value)
 Swaps bytes on big endian architectures. More...
 

Detailed Description

Computes the SHA512 hash from a byte stream.

This class is a rewrite in C++ of the sha512 hash computing algorithm present in the Libgcrypt. Please see the GNU Privacy Guard project website for more informations.

This abstract class implements the SHA384 hash and SHA512 hash computing.

Definition at line 44 of file sha384_512.hpp.

Member Function Documentation

◆ finish()

void libxcks::AbstractSHA512Impl::finish ( )
protected

Process the remaining bytes in the internal buffer and the usual prolog according to the standard.

Definition at line 81 of file sha384_512.cpp.

◆ reset()

void libxcks::AbstractSHA512Impl::reset ( )
overridepure virtual

Resets the checksum to initial value.

Implements libxcks::LibgcryptHash.

Implemented in libxcks::SHA512, and libxcks::SHA384.

◆ transform()

void libxcks::AbstractSHA512Impl::transform ( uint8_t *  data)
protected

Transform the message X which consists of 16 64-bit-words.

It is assumed that data has the lenght of 16 64-bit-words.

Parameters
dataThe data to process.

Definition at line 205 of file sha384_512.cpp.

◆ update()

void libxcks::AbstractSHA512Impl::update ( const uint8_t *  buf,
size_t  len 
)
finaloverridevirtual

Updates the SHA512 hash with specified array of bytes.

Parameters
bufThe byte array to update the SHA512 hash with.
lenThe number of bytes to use for the update.

Implements libxcks::Checksum.

Definition at line 164 of file sha384_512.cpp.

Member Data Documentation

◆ count

int libxcks::AbstractSHA512Impl::count
protected

Current size of the input buffer.

Definition at line 58 of file sha384_512.hpp.

◆ h0

uint64_t libxcks::AbstractSHA512Impl::h0
protected

First part of the state of computation.

Definition at line 48 of file sha384_512.hpp.

◆ h1

uint64_t libxcks::AbstractSHA512Impl::h1
protected

Second part of the state of computation.

Definition at line 49 of file sha384_512.hpp.

◆ h2

uint64_t libxcks::AbstractSHA512Impl::h2
protected

Third part of the state of computation.

Definition at line 50 of file sha384_512.hpp.

◆ h3

uint64_t libxcks::AbstractSHA512Impl::h3
protected

Fourth part of the state of computation.

Definition at line 51 of file sha384_512.hpp.

◆ h4

uint64_t libxcks::AbstractSHA512Impl::h4
protected

Fifth part of the state of computation.

Definition at line 52 of file sha384_512.hpp.

◆ h5

uint64_t libxcks::AbstractSHA512Impl::h5
protected

Sixth part of the state of computation.

Definition at line 53 of file sha384_512.hpp.

◆ h6

uint64_t libxcks::AbstractSHA512Impl::h6
protected

Seventh part of the state of computation.

Definition at line 54 of file sha384_512.hpp.

◆ h7

uint64_t libxcks::AbstractSHA512Impl::h7
protected

Eighth part of the state of computation.

Definition at line 55 of file sha384_512.hpp.

◆ ibuffer

uint8_t libxcks::AbstractSHA512Impl::ibuffer[128]
protected

Input buffer.

Definition at line 59 of file sha384_512.hpp.

◆ nblocks

uint64_t libxcks::AbstractSHA512Impl::nblocks
protected

Number of blocks.

Definition at line 57 of file sha384_512.hpp.


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