MD5 Encoding

  • Thread starter Thread starter Adam Durity
  • Start date Start date
A

Adam Durity

Anyone have a good example of how to use the MD5 encoding provider class
that comes as part of the System.Security namespace?

-ALD
 
Anyone have a good example of how to use the MD5 encoding provider class
that comes as part of the System.Security namespace?

-ALD

And here is how to use it on files:

StringBuilder sb=new StringBuilder();
FileStream fs=new FileStream("filename",FileMode.Open);
BinaryReader br=new BinaryReader(fs);

MD5 md5=new MD5CryptoServiceProvider();
byte[] hash=md5.ComputeHash(br.BaseStream);

foreach (byte hex in hash)
sb.Add(hex.ToString("x2")); //convert to standard MD5 form

fs.Close();
 
Back
Top