Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_professional thread: MD5 - Comparing 2 values


Message #1 by "Mitchell Adams" <MADAMS@p...> on Tue, 05 Nov 2002 14:37:30 -0500
I got the following to work but is this the correct or cleanest way to 
handle it?

Dim HashedBytes as Byte()
HashedBytes =3D md5Hasher.ComputeHash(encoder.GetBytes(Password.Text))

If DataReader("Password").ToString =3D HashedBytes.ToString Then........






>>> MADAMS@p... 11/05/02 02:37PM >>>
I need to test against a previously hashed value stored in a database 
against one submitted by the user but the code isn't returning true.

I have the following:

If DataReader.Read()
	Dim md5Hasher as New MD5CryptoServiceProvider()
	Dim encoder as New UTF8Encoding()
		=09
	If DataReader("Password") IS md5Hasher.ComputeHash(encoder.GetBytes
(Password.Text))
		LavbelLoginMessage.Text=3D"You have access"
	Else
		LabelLoginMessage.text =3D "Invalid Password"
		LabelLoginMessage.CSSClass =3D "ErrorText"
	End If
Else
	LabelLoginMessage.text =3D "Your email address was not found"
	LabelLoginMessage.CSSClass =3D "ErrorText"
End If


Do i need to do something to the DataReader("Password") ?

Thanks

Mitch




---

ASP.NET 1.0 Namespace Reference with C#
http://www.wrox.com/acon11.asp?ISBN=3D1861007442

ASP.NET 1.0 Namespace Reference with VB.NET
http://www.wrox.com/acon11.asp?ISBN=3D1861007450

These books are a complete reference to the ASP.NET namespaces
for developers who are already familiar with using ASP.NET.
There is no trivial introductory material or useless .NET
hype and the presentation of the namespaces, in an easy-to use
alphabetical order ensures a user-friendly reference format.
We provide in-depth coverage of all the major ASP.NET classes,
giving you those real-world tips that the documentation doesn't
offer, and demonstrating complex techniques with simple
examples.

---
to unsubscribe send a blank email to leave-aspx_professional-1132476S@p...
rox.com.


  Return to Index