00001
00002
00003
00004
00005
00006 #if !defined(AFX_VMSHASH_H__A22980FB_579D_4BD9_825C_699E3BED340F__INCLUDED_)
00007 #define AFX_VMSHASH_H__A22980FB_579D_4BD9_825C_699E3BED340F__INCLUDED_
00008
00009 #if _MSC_VER > 1000
00010 #pragma once
00011 #endif
00012
00013 #include <windows.h>
00014 #pragma warning (push, 3)
00015 #include "vmsHashEvents.h"
00016 #include <string>
00017 #pragma warning (pop)
00018
00019 enum vmsHashAlgorithm
00020 {
00021 HA_CRC32,
00022 HA_MD5,
00023 HA_SHA1,
00024 HA_SHA2,
00025 };
00026
00027 enum vmsHash_SHA2Strength {
00028 HSHA2S_256,
00029 HSHA2S_384,
00030 HSHA2S_512,
00031 };
00032
00033 class vmsHash
00034 {
00035 public:
00036 void set_SHA2Strength (vmsHash_SHA2Strength en);
00037 void set_EventsHandler (vmsHashEvents* pEvents);
00038 std::string Hash (LPCSTR pszFile, vmsHashAlgorithm enHA = HA_MD5);
00039
00040 vmsHash();
00041 virtual ~vmsHash();
00042
00043 protected:
00044 std::string Hash_SHA2 (LPCSTR pszFile);
00045 std::string Hash_SHA1 (LPCSTR pszFile);
00046 std::string Hash_CRC32 (LPCSTR pszFile);
00047 std::string Hash_ResultToStr (unsigned char* pHR, int nSize);
00048 std::string Hash_MD5 (LPCSTR pszFile);
00049 UINT64 Hash_MD5_File (const char *fn, unsigned long seed, void *mdContext);
00050 vmsHashEvents* m_pEvents;
00051 int m_nSHA2Strength;
00052 };
00053
00054 #endif