MLBookProc 1.0
 
Loading...
Searching...
No Matches
Hasher Class Reference

The Hasher class. More...

#include <Hasher.h>

Inheritance diagram for Hasher:
CreateCollection RefreshCollection

Public Member Functions

 Hasher (const std::shared_ptr< AuxFunc > &af)
 Hasher constructor.
 
std::string buf_hashing (const std::string &buf)
 Creates hash sum for given buffer.
 
std::string file_hashing (const std::filesystem::path &filepath)
 Creates hash sum for given file.
 
void cancelAll ()
 Stops all operations.
 

Protected Attributes

bool cancel
 Stops all operations if true.
 
std::function< void()> stop_all_signal
 Stop signal for heir classes.
 

Detailed Description

The Hasher class.

This class contains methods for hash sums creating (Blake-256 algorithm).

Constructor & Destructor Documentation

◆ Hasher()

Hasher::Hasher ( const std::shared_ptr< AuxFunc > & af)

Hasher constructor.

Parameters
afsmart pointer to AuxFunc object.

Member Function Documentation

◆ buf_hashing()

std::string Hasher::buf_hashing ( const std::string & buf)

Creates hash sum for given buffer.

Note
This method can throw MLException in case of error.
Parameters
bufsource buffer.
Returns
32 bytes of hash sum value.

◆ file_hashing()

std::string Hasher::file_hashing ( const std::filesystem::path & filepath)

Creates hash sum for given file.

Note
This method can throw MLException in case of error.
Parameters
filepathabsolute path to file to be hashed.
Returns
32 bytes of hash sum value.

Member Data Documentation

◆ cancel

bool Hasher::cancel
protected

Stops all operations if true.

Warning
Do not call or set this variable yourself!

◆ stop_all_signal

std::function<void()> Hasher::stop_all_signal
protected

Stop signal for heir classes.

Warning
Do not call or set this variable yourself!