From WikiChip
Editing mirc/identifiers/$sha512

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

This page supports semantic in-text annotations (e.g. "[[Is specified as::World Heritage Site]]") to build structured and queryable content provided by Semantic MediaWiki. For a comprehensive description on how to use annotations or the #ask parser function, please have a look at the getting started, in-text annotation, or inline queries help pages.

Latest revision Your text
Line 1: Line 1:
 
{{mirc title|$sha512 identifier}}'''$sha512''' calculates the [[sha512 hash]] of a text, {{mirc|binary variables|binary variable}}, or file. Hash is 160-bits, shown as 40 lower-case hexadecimal characters.
 
{{mirc title|$sha512 identifier}}'''$sha512''' calculates the [[sha512 hash]] of a text, {{mirc|binary variables|binary variable}}, or file. Hash is 160-bits, shown as 40 lower-case hexadecimal characters.
 
  
 
== Synopsis ==
 
== Synopsis ==
Line 20: Line 19:
  
 
== Example ==
 
== Example ==
Echo the SHA512 hash of plain text string ''abc'' to the active window:
+
Echo the SHA1 hash of plain text string ''abc'' to the active window:
<pre>//echo -a $sha512(abc)
+
<pre>//echo -a $sha1(abc)
 
or
 
or
//echo -a $sha512(abc,0)</pre>
+
//echo -a $sha1(abc,0)</pre>
 
The DATA is case-sensitive, so hash of "abc" is different than hash of "ABC"
 
The DATA is case-sensitive, so hash of "abc" is different than hash of "ABC"
  
Echo the SHA512 hash of the zero-length null string to the active window:
+
Echo the SHA1 hash of the zero-length null string to the active window:
<pre>//echo -a $sha512($null)</pre>
+
<pre>//echo -a $sha1($null)</pre>
 +
 
 +
Echo the SHA1 hash of the first 1000 bytes of the mIRC program you're running to the active window:
 +
<pre>//bread $qt($mircexe) 0 1000 &snip | echo -a $sha1(&snip,1)</pre>
  
Echo the SHA512 hash of the first 1000 bytes of the mIRC program you're running to the active window:
+
Echo the SHA1 hash of the contents of the mIRC program you're running to the active window:
<pre>//bread $qt($mircexe) 0 1000 &snip | echo -a $sha512(&snip,1)</pre>
+
<pre>//echo -a $sha1($mircexe,2)</pre>
  
Echo the SHA512 hash of the contents of the mIRC program you're running to the active window:
+
Suggested Uses:
<pre>//echo -a $sha512($mircexe,2)</pre>
+
* Quick way to compare if 2 files are identical. (First check should always be comparing file sizes.)
 +
* Quick way to check if a file's contents have changed since stored sha1 hash was made.
 +
* Verify downloaded file hasn't been corrupted, matches the sender's original.
 +
<br />
 +
Note that because the default is N=0, '''$sha1($mircexe)''' is the SHA1 hash for the plaintext text string of the drive:\path\filename for the mIRC you're running, and not the hash of the filename contents. This differs from $crc($mircexe) giving the checksum of the filename contents because $crc has default of N=2.<br />
 +
mIRC v7.x Unicode-encodes plaintext before providing to $sha1, so v7.x and v6.x return different answers for //echo -a $sha1($chr(233))<br />
  
Note that because the default is N=0, '''$sha512($mircexe)''' is the SHA512 hash for the plaintext text string of the drive:\path\filename for the mIRC you're running, and not the hash of the filename contents. This differs from $crc($mircexe) giving the checksum of the filename contents because $crc has default of N=2.<br />
+
If the text doesn't have Unicode code points above 255, to avoid having Unicode points 128-255 encoded to 2-byte pairs, the text must be fed to $sha1 as a binary variable:<br />
mIRC v7.x Unicode-encodes bytes 128-255 to utf8 before providing to $sha512, if the text doesn't have code points above 255, you can avoid the utf8 encoding issue by using a binvar with the -a switch.
 
  
 
<pre>//bset -ta &string 1 chloé | echo -a $sha1(&string,1)</pre>
 
<pre>//bset -ta &string 1 chloé | echo -a $sha1(&string,1)</pre>
  
 
== Error Messages ==
 
== Error Messages ==
Note that $sha512 differs from $crc in that it generates error for non-existent files instead of returning hash of $null string. Also, hex string returned by $sha512 is lowercase while $crc returns uppercase hex.
+
Note that $sha1 differs from $crc in that it generates error for non-existent files instead of returning hash of $null string. Also, hex string returned by $sha1 is lowercase while $crc returns uppercase hex.
  
<pre>* Error accessing file: $sha512</pre>
+
<pre>* Error accessing file: $sha1</pre>
Either file does not exist, or file permissions don't allow the file to be read. i.e. $sha512(non-existent-file,2) or $sha512(c:\hiberfil.sys,2)
+
Either file does not exist, or file permissions don't allow the file to be read. i.e. $sha1(non-existent-file,2) or $sha1(c:\hiberfil.sys,2)
  
<pre>* Invalid parameters: $sha512</pre>
+
<pre>* Invalid parameters: $sha1</pre>
 
Either using a zero-length/non-existent binary variable or specifying an N where $int(%N) isn't 0-2.
 
Either using a zero-length/non-existent binary variable or specifying an N where $int(%N) isn't 0-2.
  
Line 52: Line 58:
  
 
== Compatibility ==
 
== Compatibility ==
{{mIRC compatibility|7.42}}
+
{{mIRC compatibility|6.3}}
  
 
== See also ==
 
== See also ==
Line 59: Line 65:
 
* {{mIRC|$sha256}}
 
* {{mIRC|$sha256}}
 
* {{mIRC|$sha384}}
 
* {{mIRC|$sha384}}
* {{mIRC|$sha1}}
+
* {{mIRC|$sha512}}
 
* [[List of identifiers - mIRC]]
 
* [[List of identifiers - mIRC]]
 
{{mIRC identifier list}}
 
{{mIRC identifier list}}
[[Category:mIRC identifiers|sha512]]
+
[[Category:mIRC identifiers|mircini]]

Please note that all contributions to WikiChip may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see WikiChip:Copyrights for details). Do not submit copyrighted work without permission!

Cancel | Editing help (opens in new window)