Page 1 of 1

Hash 0.6 - Sha256 and sha512 support

Posted: 07 Feb 2013 14:21
by 40k
Hash 0.6 - Sha256 and sha512 support
hash.xys
(4.11 KiB) Downloaded 270 times
To use the script you will require:

1. Xyplorer 7.0 or higher. The script is not tested for earlier versions but may work.

How to use:

1. Place Hash.xys into the <xypath>\Data\Scripts folder
2. Create a catalog entry to load the script or make your own toolbar button
3. Select files in Xyplorer that you wish to checksum
4. Choose from 3 possible checksum formats as displayed below

Development History:

CURRENT VERSION: 0.6

Changelog:

Code: Select all

V0.6
+ support for hashing with SHA256 and SHA512 algorythms.

V0.5
+ Switched most of the code to HEREDOC format.
+ Added new script feature: "Compare to known checksum"
> This new feature will first display a text input box. You can input any amount of text that contains checksums for the files you are about to hash. Usually these checksums come from a trusted source, such as the website where you are downloading your files from, or from a .NFO file.
> The script will automatically calculate checksums and compare them to the checksums you provided.
> When matches are found this is clearly indicated in the report text box that appears when the script is done.

! Caution: Checksum matching only indicates the file on your hard drive is an exact copy of the file on the server. It does not provide any information on whether this file is safe or not. Always verify your checksums are coming from an official source. Try doing a Google search for your MD5 and SHA1 sum. If Google does not find any results and your file is a software package, be suspicious.
Image

Image

Image

Image

0.4 - 11
0.5 - 38

Re: Hash script with multiple modes

Posted: 07 Feb 2013 15:20
by Marco
You really helped me because I really needed to quickly calculate a bunch of hashes! Here's the result, bottom of top message. Thank you!

Re: Hash script with multiple modes

Posted: 08 Feb 2013 01:35
by PeterH
Just a bit to syntax...

I didn't look for function, but only for form. I think your code isn't bad or so. Just 2 minor things.

Instead of get("SelectedItemsPathNames",|,a) you should write get("SelectedItemsPathNames","|","a") - both "|" and "a" are strings and should be specified quoted.

Even original help sometimes shows this wrong, for example 2 consecutive lines show:
echo get("bytesselected", i); //inactive pane's sel. bytes
text get("selecteditemsnames", , "i"); //inactive pane's sel. items, one per line
Specifying a string unquoted may work today, but not work tomorrow...


And a bit of optimization: in double quotes you can specify variables. So e.g. instead of

Code: Select all

   $c = $c . $hashedfilename <crlf> . "Size  : " . $checksize . <crlf> ."MD5   : ". $checkmd5 . <crlf> . "SHA-1 : " . $checksha1 . <crlf> . "CRC32 : " . $checkcrc32 .<crlf 2>;
you might write

Code: Select all

  $c = "$c$hashedfilename<crlf>Size  : $checksize<crlf>MD5   : $checkmd5<crlf>SHA-1 : $checksha1<crlf>CRC32 : $checkcrc32<crlf 2>";
But be careful: the name of a variable in double quotes must be followed by a character that's not allowed in variable names, (like $ or blank,) so

Code: Select all

   $c = $c."Google: ".$g_AboutResults2." hits<crlf 2>";
can be changed to

Code: Select all

   $c = $c."Google: $g_AboutResults2 hits<crlf 2>";
where the leading $c cannot be integrated into the quotes. (It would become the variable name $cGoogle) If you could add a blank in front of Google it would be possible...

Edit: some typo :oops:

Re: Hash script with multiple modes

Posted: 08 Feb 2013 11:14
by 40k
Thanks for the pointers Peter!

Re: Hash script with multiple modes

Posted: 09 Feb 2013 21:19
by Enternal
This is really awesome! It works well and pretty fast too! Hmm... just a suggestion but it might be easier if you mark when you updated your script. As of now, it's hard to tell if you have updated your script or not unless we actually compare the code. Anyway thank you very much for this useful script!

Re: Hash 0.4 - New update

Posted: 07 Jun 2013 15:25
by 40k
Updated this one.

Re: Hash 0.5 - New compare Hash to trusted source feature

Posted: 03 Jul 2013 14:46
by 40k
New feature in 0.5!

Re: Hash 0.5 - New compare Hash to trusted source feature

Posted: 04 Jul 2013 02:02
by RalphM
It would make life easier for the users of your scripts if you could put some version info in the header of the script files and maybe name the download files accordingly too.

Re: Hash 0.6 - Sha256 and sha512 support

Posted: 05 Dec 2014 16:36
by 40k
I gave this one an update that's long overdue. There's support now for hasing with SHA 256 and 512.