SHAdigest (String function)

From m204wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

20-byte SHA digest (String class)


The SHAdigest intrinsic function returns the 20-byte (always) binary string that is the SHA-1 digest of the method object string.

Syntax

%outString = string:SHAdigest

Syntax terms

%outString A string variable to receive the SHA-1 digest of the method object string.
string The string to which the method is applied.

Usage notes

  • SHA (Secure Hash Algorithm) is a set of cryptographic hashing functions; SHAdigest provides SHA-1, which was the most commonly used. SHA-1 is no longer recommended for the signing of Internet security certificates. A complete explanation of SHA hashing can easily be found on the internet.
  • This method is useful for storing one-way encrypted passwords in a file. SHA is considered unreversible. That is, the only way to get a password given a digest is brute force: trying passwords until one produces the digest (more or less a hash) value.
  • SHAdigest is available for use by Model 204 V7.5 or Janus Network Security customers.
  • SHAdigest is available as of Sirius Mods Version 7.3.

Examples

The 20-byte SHA-1 hash of a string is typically expressed as a 40-digit hex value. In the following example, the output string from the SHAdigest method is converted to hex using the StringToHex intrinsic method:

printText {~} is {'this is a simple test':shadigest:stringtohex}

The result is:

'this is a simple test':shadigest:stringtohex is BC38AA2D6769639946806616C14AF0C69477AABE

See also