26 lines
982 B
C
26 lines
982 B
C
#pragma once
|
|
|
|
#include "libEncrypt_MD5.h"
|
|
#include "libEncrypt_SHA256.h"
|
|
#include "libEncrypt_CRC32.h"
|
|
|
|
/**
|
|
* Calculates the MD5 hash of the contents of a specified file.
|
|
*
|
|
* @param szFileName The path to the input file to be hashed.
|
|
* @param result Reference to an MD5Digest object where the computed hash will be stored.
|
|
* @return true if the hash is calculated successfully; false otherwise.
|
|
*
|
|
* The function performs the following steps:
|
|
* 1. Validates the input file name.
|
|
* 2. Opens the file in binary read mode.
|
|
* 3. Reads the file in 1024-byte chunks and updates the MD5 context with each chunk.
|
|
* 4. Finalizes the MD5 calculation and stores the result in the provided MD5Digest reference.
|
|
* 5. Cleans up resources and returns true on success, or false if any error occurs.
|
|
*/
|
|
bool md5File(const char* szFileName, MD5Digest& result);
|
|
|
|
bool sha256File(const char* szFileName, Sha256Digest& result);
|
|
|
|
bool crc32File(const char* szFileName, uint32_t& result);
|