cryptoHash()

Allows to create a checksum for a string or blob element.

Synopsis

string cryptoHash(blob|string data, string algorithm = "MD5");

Parameter

Parameter Description
data String or blob element for which a checksum shall be created.
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

Errors

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

Description

The function cryptoHash() allows to create a checksum for elements of the data types string and blob. Additionally the algorithm for creating the checksum can be stated.

example

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

main()
{
  string s = "Example String";
  DebugN(cryptoHash(s));
}

Assignment

Availability

CTRL