SHAdigest (String function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
m (match syntax diagram to revised template; fix tags.)
Line 1: Line 1:
{{Template:String:SHAdigest subtitle}}
{{Template:String:SHAdigest subtitle}}


This [[Intrinsic classes|intrinsic]] function returns the 20-byte (always) binary string that is the
The <var>SHAdigest</var> [[Intrinsic classes|intrinsic]] function returns the 20-byte (always) binary string that is the SHA digest of the method object string.
SHA digest of the method object string.


The <var>SHAdigest</var> function is available as of version 7.3 of the <var class=product>Sirius Mods</var>.
==Syntax==
==Syntax==
{{Template:String:SHAdigest syntax}}
{{Template:String:SHAdigest syntax}}
===Syntax terms===
===Syntax terms===
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>%outStr</th>
<tr><th>%outString</th>
<td>A string variable to receive the SHA digest of the method object string.                               </td></tr>
<td>A string variable to receive the SHA digest of the method object <var class="term">string</var>.</td></tr>
<tr><th>string</th>
<tr><th>string</th>
<td>The string to which the method is applied.</td></tr>
<td>The string to which the method is applied.</td></tr>
Line 16: Line 14:


==Usage notes==
==Usage notes==
*SHA (Secure Hash Algorithm) is a set of cryptographic hashing functions;  <var>SHAdigest</var> provides SHA-1, the most commonly used. A complete explanation of SHA hashing can easily be found on the internet.
<ul><li>SHA (Secure Hash Algorithm) is a set of cryptographic hashing functions;  <var>SHAdigest</var> provides SHA-1, the most commonly used. A complete explanation of SHA hashing can easily be found on the internet.
*<var>SHAdigest</var> is available for use by '''''Janus SOAP''''' or '''''Janus Network Security''''' customers.
<li><var>SHAdigest</var> is available for use by <var class="product">[[Janus_SOAP|Janus Soap]]</var> or <var class="product">[[Janus Network Security]]</var> customers.
*[[MD5digest (String function)|MD5digest]] returns the MD5 digest of the method object string, and [[RC4encrypt (String function)|RC4encrypt]] returns the RC4 encryption of the method object string.
<li><var>SHAdigest</var> is available as of <var class="product">[[Sirius Mods]]</var> version 7.3.</ul>


==Examples==
==Examples==
 
<ol><li>The 20-byte SHA hash of a string is typically expressed as a 40-digit hex value. In the following example, the output string from the <var>SHAdigest</var> method is converted to hex using the [[StringToHex (String function)|StringToHex]] intrinsic method:
The 20-byte SHA hash of a string is typically expressed as a 40-digit hex value. In the following example, the output string from the <var>SHAdigest</var> method is converted to hex using the [[StringToHex (String function)|StringToHex]] intrinsic method:
<p class="output">printText {'this is a simple test':shadigest:stringtohex}
<p class="output">[[Intrinsic classes#printtext|printText]] {'this is a simple test':shadigest:stringtohex}
 
</p>
</p>
The result (displayed on two lines) is:
The result (displayed on two lines) is:
<p class="output">'this is a simple test':shadigest:stringtohex is BC38AA2D6769639946806616C14AF0C69477AABE
<p class="output">'this is a simple test':shadigest:stringtohex is BC38AA2D6769639946806616C14AF0C69477AABE
 
</p></ol>
</p>
==See also==
==See also==
<ul><li><var>[[MD5digest (String function)|MD5digest]]</var> returns the MD5 digest of the method object string, and <var>[[RC4encrypt (String function)|RC4encrypt]]</var> returns the RC4 encryption of the method object string.
<li>For details of the <var>printtext</var> statement, please see <var>[[Intrinsic classes#printtext|printText]]</var></ul>
{{Template:String:SHAdigest footer}}
{{Template:String:SHAdigest footer}}

Revision as of 05:52, 2 February 2011

20-byte SHA digest (String class)


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

Syntax

%outString = string:SHAdigest

Syntax terms

%outString A string variable to receive the SHA 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, the most commonly used. A complete explanation of SHA hashing can easily be found on the internet.
  • SHAdigest is available for use by Janus Soap or Janus Network Security customers.
  • SHAdigest is available as of Sirius Mods version 7.3.

Examples

  1. The 20-byte SHA 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 {'this is a simple test':shadigest:stringtohex}

    The result (displayed on two lines) is:

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

See also

  • MD5digest returns the MD5 digest of the method object string, and RC4encrypt returns the RC4 encryption of the method object string.
  • For details of the printtext statement, please see printText