HashAlgorithm

HashAlgorithm


Represents a common interface implemented by all hashing algorithms.


Public:

Properties:

NameDescription
 CanReuseTransform (get) Returns if the hash algorithm implementation can be reused once a hash has been computed.  
 CanTransformMultipleBlocks (get) Returns if the hash algorithm implementation can processd multiple blocks of data at a time.  
 Hash (get) Returns the computed hash after all data has been processed.  
 HashSize (get) Returns the size of the hash value in bits.  
 InputBlockSize (get) Returns the size of the input block size allowed.  
 OutputBlockSize (get) Returns the size of the output block.  

Methods:

NameDescription
 Clear Releases any resources being held by the hash algorithm.  
 ComputeHash Computes the hash on a source in its entirety.  
 Equals Returns if the Value is equal to this object instance.  
 GetHashCode Returns a pseudo-unique number identifying this instance.  
 Initialize Resets a hashing object to begin hashing a new value.  
 ToString Returns a string representation of this object instance.  
 TransformBlock Continues to compute the hash value for blocks of data.  
 TransformFinalBlock Finalizes the hash computation by processing the last block of data.  

Remarks

A hash is a fixed-length data that can represent unique variable-length data. The size of the hash determines the ability for different data to have a unique hash value. Since hash values are fixed-length, there are a fixed number of possible hash values, which must represent an infinite number of variable-length data.

Hashes are powerful in that a tiny change in the input data will cause a large change in the computed hash value. This provides the ability to detect when data has been altered.

It is possible for two variable-length data to have the same hash value, but the chances are so remote as to be practically impossible. The larger the hash value, the more impractical is becomes to find a duplicate hash value.

See Also

Project CorLib Overview

Class HashAlgorithm Overview

SHA1CryptoServiceProvider

SHA1Managed

SHA256Managed

SHA384Managed

SHA512Managed

RIPEMD160Managed

MD5CryptoServiceProvider