# LogDoctor: HashOps Class Reference

Loading...
Searching...
No Matches
HashOps Class Referencefinal

HashOps. More...

`#include <hash.h>`

## Public Member Functions

void | setDialogLevel (const DialogsLevel new_level) noexcept
| Sets the new Dialogs level.
bool | loadUsedHashesLists (const std::string &db_path) noexcept
| Retrieves the lists of hashes from the database file.
bool | hasBeenUsed (const std::string &file_hash, const WebServer &web_server) const noexcept
| Checks if the given hash equals one which is already in the list.
void | insertUsedHashes (const std::string &db_path, const std::vector< std::string > &hashes, const WebServer &web_server)
| Inserts multiple hashes in the corresponding database table.

## Static Public Member Functions

static void | digestFile (const std::string &file_path, std::string &hash)
| Returns the hash resulting from the content of the given file.

## Detailed Description

HashOps.

Operations for the hashes

## Member Function Documentation

## digestFile()

void HashOps::digestFile | ( | const std::string & | file_path,
|  | std::string & | hash )

static

Returns the hash resulting from the content of the given file.

Parameters

  file_path | The path of the file to process

Returns
  The sha256 hash

Exceptions

  GenericException |

See also
  SHA256

## hasBeenUsed()

bool HashOps::hasBeenUsed | ( | const std::string & | file_hash,
|  | const WebServer & | web_server ) const

noexcept

Checks if the given hash equals one which is already in the list.

Parameters

  file_hash | The sha256 hash to compare
  web_server_id | The ID of the Web Server which generated the file

Returns
  Whether the hash is already in the list or not

## insertUsedHashes()

void HashOps::insertUsedHashes | ( | const std::string & | db_path,
|  | const std::vector< std::string > & | hashes,
|  | const WebServer & | web_server )

Inserts multiple hashes in the corresponding database table.

Parameters

  db_path | The path of the Hashes database
  hashes | The list of hashes to insert
  web_server_id | The ID of the Web Server which generated the file

Exceptions

  VoidException |

## loadUsedHashesLists()

bool HashOps::loadUsedHashesLists | ( | const std::string & | db_path | ) |

noexcept

Retrieves the lists of hashes from the database file.

Parameters

  db_path | The path of the log files' Hashes database

Returns
  Whether the operation has been successful or not

Exceptions

  VoidException |

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

- logdoctor/modules/craplog/modules/hash.h
- logdoctor/modules/craplog/modules/hash.cpp