Latest version:
.NET (C#)

   The FAQs
   Hash algorithms
   Command-line use

HashSum is hosted by Logo
HashSum documentation
Frequently Asked Questions (FAQs)

What are hash algorithms and what makes them so important?

A hash algorithm is a cryptographic function similar in concept to a symmetric cipher, but their implementations differ greatly.

A symmetric cipher takes a N-block message (or plain text, even if the message is not text), where the block length is defined by the algorithm, and a fixed length key. Then feeds each block of the message along with the key to the encryption function, the "core" of the cipher itself. For each block of input, the function generates a block of output, so the output is a N-block ciphertext.

A hash algorithm takes a N-block message too, but no key. It also feeds each block of the message to a function, called the compression function here, but each block of output is not just put on a stream: it's refed to the compression function along with each new block of message. Thus, the final output is a fixed length hash.

Of course, the differences are not crystal clear: most current encryption algorithms combine the last output with the new message, usually with XOR operations, to avoid tampering (if a single bit is changed, the same bit in all following blocks will be mangled). Also, many hash algorithms require a key to prevent anyone just replacing the hash when the message is modified. So, the only clear difference is: ciphers generate variable length outputs (maybe in fixed increments), while hash algorithms generate fixed length outputs.

Another kind of function is a checksum. In many points of the program and this site, they are just called "hash algorithms", but they are not, for they have not been designed with security in mind, even if their structure is similar to that of true hash algorithms.