|
-
Jul 28th, 2008, 04:05 PM
#1
Thread Starter
Lively Member
[RESOLVED] Help with a Hash Password
Hello evryone:
I am new in programming and I am using VB2005.
I have a program where I have created an Add new user form and a Reset Password form.
When I create a new user I have setup a default password "Support", I have setup an IF statement that when the user logs in that if the password = 'Support" to bring up the Reset password form, where they would create a new one of their own
I have added a HashPassword feature to my code: The code to hash the password is the following:
HTML Code:
Private Function HashPassword(ByVal password As String) As _
String
Dim hash As String = ""
Dim i As Integer
For i = 0 To password.Length - 1
hash &= Chr(Asc(password.Substring(i, 1)) + 1)
Next i
Return hash
End Function
In the OK event when I first login I have the following:
HTML Code:
IF TextPassword.text = "Support" Then
Msgbox = "Please change your Temporary password now", vbOKOnly
ResetpasswordForm.Show()
Exit sub
End if
The problem is that is, if I type "Support" under tha password textbox, it doesn't display the resetPasswordForm, it just take me into the program.
What am I missing?
Thanks and I hope I am making sense.
-
Jul 28th, 2008, 07:05 PM
#2
Re: Help with a Hash Password
If you really want to calculate a hash, you should use a real hash algorithm. .Net has some built in, like the MD5 hash:
http://www.nonhostile.com/howto-calc...ing-vb-net.asp
You should also consider adding some salt to your hash, so it is not the same for two identical password values.
This line:
Code:
Msgbox = "Please change your Temporary password now", vbOKOnly
Should not even compile. If you want to show a messagebox, use
Code:
MessageBox.Show("Please change your password now.","Change Password", MessageBoxButtons.OK)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|