File Scanner 1.0.0
A high-performance C++ malicious file scanner.
Loading...
Searching...
No Matches
scanner::Md5FileHasher Class Referencefinal

An implementation of IFileHasher that calculates MD5 hashes. More...

#include <md5_file_hasher.h>

Inheritance diagram for scanner::Md5FileHasher:
Inheritance graph
Collaboration diagram for scanner::Md5FileHasher:
Collaboration graph

Public Member Functions

std::string HashFile (const std::filesystem::path &file_path) override
 Calculates the MD5 hash of a given file.
 
- Public Member Functions inherited from scanner::IFileHasher
virtual ~IFileHasher ()=default
 

Detailed Description

An implementation of IFileHasher that calculates MD5 hashes.

This class uses a streaming approach to handle files of any size without consuming large amounts of memory. It is an internal, non-exported class.

Member Function Documentation

◆ HashFile()

std::string scanner::Md5FileHasher::HashFile ( const std::filesystem::path &  file_path)
overridevirtual

Calculates the MD5 hash of a given file.

Opens the file and reads it in chunks, feeding them into the MD5 algorithm.

Parameters
file_pathThe path to the file to be hashed.
Returns
A string representing the lowercase hexadecimal MD5 hash.
Exceptions
std::runtime_errorif the file cannot be opened.
std::ios_base::failureon stream reading errors.

Implements scanner::IFileHasher.


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