getFileCryptoHash()

Allows to create a checksum for a file.

Synopsis

string getFileCryptoHash(string fileName, string algorithm = "MD5");

Parameter

Parameter Description
fileName Name or path of the file
algorithm

Following algorithms are available:

  • MD5 (default)
  • MD4
  • SHA1
  • SHA224
  • SHA256
  • SHA384
  • SHA512
  • SHA3_224
  • SHA3_256
  • SHA3_384
  • SHA3_512

Return value

hash value in hexadecimal format

Error

In case of an error an empty string will be returned and a corresponding message will be displayed in the LogViewer.

Description

The function getFileCryptoHash() allows to create a checksum for a file. Additionally the algorithm for creating the checksum can be stated.

example

Following example creates a checksum for the login.pnl and displays it inside the logviewer. The algorithm "MD5" will be used.

main()
{
  string s = "login.pnl";
  DebugN(getFileCryptoHash(s));
}

Assignment

Availability

CTRL, UI