Monday 2 June 2008

Hashing - Using C# and .Net Framework

A Cryptographic one-way hash function is used to generate a fixed length hash value as a transformation from a specific input. It should be computationally feasible in that it should

  • Not have the Avalanche Effect in producing the hash value
  • Given h it should be hard to find any m such that h = hash(m)
  • It should be collision resistant, i.e given an input m1, It should be hard to find another input, m2 (not equal to m1) such that  hash(m1) = hash(m2)
  • Resistant to Birthday attacks

.Net Framework BCL provides solid support to some cryptographic hash functions like MD5,SHA1,SHA128,SHA384 and SHA512. I've written a small demo program to compute hash and verify them using the listed cryptographic hash algorithms.

Class Diagram

Hashing_CS

 

 

 

 

 

 

 

 

 HashSHA 

HashSHA512 

TestHarness

Output

TestHarness_Output

No comments:

Post a Comment