EP_CryptHashFileA
EP_CryptHashFileA calculates hash of the user defined file.
Parameters
- Hash - the type of the hash for calculation.
Hash Type |
Parameter = Value |
XOR32 |
HASH_XOR32 = 0 |
MD2 |
HASH_MD2 = 1 |
MD5 |
HASH_MD5 = 2 |
RipeMD160 |
HASH_RipeMD160 = 3 |
SH1 |
HASH_SH1 = 4 |
SHA224 |
HASH_SHA224 = 5 |
SHA256 |
HASH_SHA256 = 6 |
SHA384 |
HASH_SHA384 = 7 |
SHA512 |
HASH_SHA512 = 8 |
- FileName- the name of the file, a pointer to the null terminated ANSI string.
- Digest - a pointer to the buffer for storing the hash value.
Return Value
If the function succeeds, the return value is the size of hash (that is stored in Digest buffer) in bytes. If the function fails, the return value is 0.
Hash Type |
Hash Size (bytes) |
XOR32 |
4 |
MD2 |
16 |
MD5 |
16 |
RipeMD160 |
20 |
SH1 |
20 |
SHA224 |
28 |
SHA256 |
32 |
SHA384 |
48 |
SHA512 |
64 |
Remark
The function fails in the following cases:
- FileName is not set;
- FileName is not readable;
- Digest buffer is not allocated;
- Digest buffer is write protected;
- the application is not protected.
Definition
Show/Hide C++ function definition
extern "C" __declspec( dllimport ) __stdcall int EP_CryptHashFileA( int Hash, char* FileName, byte* Digest);
Show/Hide Delphi function definition
function EP_CryptHashFileA(Hash : Cardinal; FileName : PAnsiChar; Digest : pointer) : Cardinal; stdcall;
Show/Hide C# (.NET) function definition
public class Enigma_IDE
{
[DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
public static extern int EP_CryptHashFileA(int Hash, string FileName, IntPtr Digest);
}
See function examples in the installation folder, Examples\Hashes subfolder.