Click here to Skip to main content
12,500,818 members (44,587 online)
Click here to Skip to main content
Add your own
alternative version

Stats

221.3K views
11.9K downloads
115 bookmarked
Posted

ReHash - A console-based hash calculator

, 11 Apr 2003
Rate this:
Please Sign up or sign in to vote.
A console-based hash calculator. Supported algorithms: CRC-16, CRC-16-CCITT, CRC-32, FCS-16, FCS-32, GHash-32-3, GHash-32-5, GOST-Hash, HAVAL-5-256, MD2, MD4, MD5, SHA-1, SHA-256, SHA-384, SHA-512, Tiger.
<!-- Article image -->

Sample Image - rehash.jpg

<!-- Add the rest of your HTML here -->

Contents


Introduction

ReHash is a free, open source console-based hash calculator.

You can disable hash algorithms selectively per command-line if you don't need or like them, you can choose if you want to use recursive directory scanning or not.

This tool is ideal for webmasters who wish to provide their users hash values of their (downloadable) files. The complete hashing process can be automated by using a shell/batch script. No additional user interaction is needed (i.e. the program won't ask for anything, it's just using the command-line).

ReHash is distributed under the terms of the GNU General Public License v2.


Supported algorithms

The current version of ReHash supports the following hash algorithms:

Algorithm
Standard
Inventor
Hash Digest Size
CRC-16  
16 bits
CRC-16-CCITT  
16 bits
CRC-32ANSI X3.66, FIPS PUB 71 
32 bits
FCS-16  
16 bits
FCS-32  
32 bits
GHash (GHash-32-3, GHash-32-5)--
32 bits
GOST-HashR 34.11-94 
256 bits
HAVAL (5 passes, 256 bits) Zheng, Pieprzyk,
Seberry
256 bits
MD2RFC 1319Rivest
128 bits
MD4RFC 1320Rivest
128 bits
MD5RFC 1321Rivest
128 bits
SHA-1FIPS PUB 180-1NIST/NSA
160 bits
SHA-2 (SHA256/SHA384/SHA512) NIST/NSA
256/384/512 bits
SizeHash-32--
32 bits
Tiger Anderson, Biham
192 bits


Usage

rehash.exe [options] filespec [> outputfile]

The command-line is parsed from the left to the right. So if you execute ReHash like this:
rehash.exe -all -none *.*
it will output nothing, because you first activate all algorithms and then deactivate them all.


Some usage examples:

Hash all INI files in C:\Windows (including subdirectories) using all hash algorithms:
rehash.exe C:\Windows\*.ini

Hash all INI files in C:\Windows (excluding subdirectories) using all hash algorithms:
rehash.exe -norecur C:\Windows

Hash all BAT files on C:\ (including subdirectories) using only MD5 and SHA-1 (remember command-line is parsed from the left to the right):
rehash.exe -none -md5 -sha1 C:\*.bat

Hash all files in C:\Temp (excluding subdirectories) using only the GOST algorithm:
rehash.exe -norecur -none -gost C:\Temp\*

Hash all ZIP files in C:\homepage (including subdirectories) using only the MD5 algorithm and output the hashes to C:\homepage\downloads\hashes.txt:
rehash.exe -none -md5 C:\homepage\*.zip > C:\homepage\downloads\hashes.txt

All options:

Option
Description
-help / -h / -?/
-version / -v
Print some information about ReHash.
-fullpath / -fOutput the full paths of hashed files.
-nopathJust output the filenames of hashed files, not the full paths to the files.
-rcrsv / -recur / -rRecursive scanning. Scan all files in the specified path including files in subdirectories.
-norcrsv / -norecurDisable recursive scanning. Scan only the files in the specified path not including subdirectories.
-all / -aEnable all algorithms.
-none / -nDisable all algorithms.
-crc16 / -nocrc16Enable/disable the CRC-16 algorithm.
-crc16c / -nocrc16cEnable/disable the CRC-16-CCITT algorithm.
-crc32 / -nocrc32Enable/disable the CRC-32 algorithm.
-fcs16 / -nofcs16Enable/disable the FCS-16 algorithm.
-fcs32 / -nofcs32Enable/disable the FCS-32 algorithm.
-ghash3 / -noghash3Enable/disable the GHash-3 algorithm.
-ghash5 / -noghash5Enable/disable the GHash-5 algorithm.
-gost / -nogostEnable/disable the GOST-Hash algorithm.
-haval / -nohavalEnable/disable the HAVAL-5-256 algorithm.
-md2 / -nomd2Enable/disable the MD2 algorithm.
-md4 / -nomd4Enable/disable the MD4 algorithm.
-md5 / -nomd5Enable/disable the MD5 algorithm.
-sha1 / -nosha1Enable/disable the SHA-1 algorithm.
-sha256 / -nosha256Enable/disable the SHA-256 algorithm.
-sha384 / -nosha384Enable/disable the SHA-384 algorithm.
-sha512 / -nosha512Enable/disable the SHA-512 algorithm.
-size32 / -nosize32Enable/disable the Size-32 algorithm (simply the byte-count of the message).
-tiger / -notigerEnable/disable the TIGER algorithm.


Thanks / acknowledgements

Thanks to (no particular order):
  • Markku-Juhani O. Saarinen - GOST-Hash implementation
  • Yuliang Zheng - HAVAL implementation
  • Wei Dai - implementations of various algorithms
  • Dr Brian Gladman - SHA-1/SHA-2 implementation
  • Tom St Denis - Tiger implementation

History

  • 12 April 2003 - v1.0
    First public release

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Dominik Reichl
Software Developer
Germany Germany
Dominik started programming in Omikron Basic, a programming language for the good old Atari ST. After this, there was some short period of QBasic programming on the PC, but soon he began learning C++, which is his favorite language up to now.

Today, his programming experience includes C / C++ / [Visual] C++ [MFC], C#/.NET, Java, JavaScript, PHP and HTML and the basics of pure assembler.

He is interested in almost everything that has to do with computing, his special interests are security and data compression.

You can find his latest freeware, open-source projects and all articles on his homepage: http://www.dominik-reichl.de/

You may also be interested in...

Pro
Pro

Comments and Discussions

 
QuestionThank you Pin
juankre29-Dec-11 12:12
memberjuankre29-Dec-11 12:12 
Generalsha1 16 bits Pin
wassimznaidi15-May-08 7:35
memberwassimznaidi15-May-08 7:35 
GeneralSHA-0 Pin
Gelly Mazour24-Feb-08 22:57
memberGelly Mazour24-Feb-08 22:57 
GeneralNice work! Pin
Willian.BR7-Feb-08 4:23
memberWillian.BR7-Feb-08 4:23 
QuestionThanks Pin
gamakanna30-Jan-07 23:34
membergamakanna30-Jan-07 23:34 
GeneralDoesn't beat crypto++ Pin
haploid30-Nov-06 2:32
memberhaploid30-Nov-06 2:32 
QuestionMistake in SHA-512 calculation. Pin
patti ashwin17-Nov-06 17:37
memberpatti ashwin17-Nov-06 17:37 
Questionwhat is the polynomial used in the CRC-16 algorithm? Pin
PauMs2-Oct-06 12:22
memberPauMs2-Oct-06 12:22 
Generala small bug Pin
waldermort30-Sep-06 21:47
memberwaldermort30-Sep-06 21:47 
GeneralThank you so much Pin
calsurferpunk28-Aug-06 5:28
membercalsurferpunk28-Aug-06 5:28 
GeneralNice work Pin
HatemMostafa24-Mar-06 0:08
memberHatemMostafa24-Mar-06 0:08 
GeneralRe: Nice work Pin
15-Aug-06 4:28
memberElNoNo15-Aug-06 4:28 
Generalhelp maual Crypto++ Pin
Anonymous25-Dec-03 0:23
sussAnonymous25-Dec-03 0:23 
Generalneed a way to be able to use this in VB 6 Pin
wtyd66612-May-03 6:19
memberwtyd66612-May-03 6:19 
Generalprova0 Pin
ocean06-May-03 2:04
memberocean06-May-03 2:04 
GeneralCRC algorithms Pin
Tim Smith13-Apr-03 6:09
memberTim Smith13-Apr-03 6:09 
GeneralRe: CRC algorithms Pin
jacques_freedom31-Mar-04 22:10
memberjacques_freedom31-Mar-04 22:10 
GeneralRe: CRC algorithms Pin
Dominik Reichl1-Apr-04 0:19
memberDominik Reichl1-Apr-04 0:19 
I have a question about CRC and MD5 algorithms:
Is it easy to generate the same int or long value with different strings?


For CRC: CRC has been designed to detect random transmission errors, so you can easily verify corrupted downloads or something like this. BUT you can easily find strings that hash to the same CRC value. In other words: CRCs aren't resistant against attacks, but are fine to quickly check for transmission errors.

For MD5: MD5 is cryptographically secure. This means that it is computationally infeasible ( = it's not impossible but currently nobody can do it) to find two strings that hash to the same MD5 value. MD5 is a 128-bit hash, so compared to a CRC-32 it should also be more collision-resistant.

So, to sum it up: if you need a secure hash then use MD5. If you just want to quickly check if a downloaded file isn't corrupted then use CRC.

Best regards,
Dominik



_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do?? Wink | ;)
(doesn't work on NT)

GeneralRe: CRC algorithms Pin
Panic2k324-Jan-05 13:34
memberPanic2k324-Jan-05 13:34 
Generalcould be cool but... Pin
Jim Crafton13-Apr-03 5:01
memberJim Crafton13-Apr-03 5:01 
GeneralRe: could be cool but... Pin
Chris Losinger13-Apr-03 6:50
memberChris Losinger13-Apr-03 6:50 
GeneralRe: could be cool but... Pin
Jim Crafton13-Apr-03 11:05
memberJim Crafton13-Apr-03 11:05 
GeneralRe: could be cool but... Pin
Tim Smith14-Apr-03 5:11
memberTim Smith14-Apr-03 5:11 
GeneralUseful... but would like to see a managed code version :-) Pin
Jabes12-Apr-03 5:53
memberJabes12-Apr-03 5:53 
GeneralRe: Useful... but would like to see a managed code version :-) Pin
darkfader9-Jul-03 8:06
sussdarkfader9-Jul-03 8:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.160919.1 | Last Updated 12 Apr 2003
Article Copyright 2003 by Dominik Reichl
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid