How to create hashcode

daveofgv

Well-known member
Joined
Sep 17, 2008
Messages
218
Location
Dallas, TX
Programming Experience
1-3
Hello all,

I have a simple solution that has a user name and password to enter the admin panel. I have (both) user name and password as a setting in my program and the password is a hashcode.

I had some help setting these up and the other person did not show me how to change the value of the hashcode to anything else except what he told me.

Everything works fine, however, I would like to change the password to another password before I deploy it.

Right now the password is "passwd" and the value in the settings is a bunch of numbers.

Does Visual Studio 2008 Pro generate the value of a hashcode or do I have to get another program to do so?

Also, how do you generate the value of hashcode?

Thanks in advanced
daveofgv
 
Hello.

These bunch of numbers is not hexadecimal? If it is hexa with a length of 32(?) signs you'll look most likely at a MD5...otherwise, without knowing the algorithm of the hash you'll be pretty locked out.

Something to read:
[ame=http://en.wikipedia.org/wiki/Hash_function]Hash function - Wikipedia, the free encyclopedia[/ame]

System.Security.Cryptography Namespace ()

Bobby
 
Under my project - settings I have
name = PasswordHashCode
type = string
scope = user
value = 796871038

I then put the code:

VB.NET:
 If _userTextBox.Text = My.Settings.Username AndAlso _passTextBox.Text.GetHashCode() = My.Settings.PasswordHashcode Then
            MessageBox.Show("Access Granted!")
            MessageBox.Show("You must login everytime to access the Admin Panel!")
            AdminPanel.Show()
            Me.Close()

Would possibly explain this to me since I am not sure if there is an easier way to do it? And maybe help find out where the value number is coming from?

Thank you
daveofgv
 
Oh...this is easy. That's a build-in Hash Function from .NET. To gwt the value just go to the direct window in Visual Studio and type:
VB.NET:
?"NewPass".GetHashCode()

This should do the trick,

Bobby
 
Perfect....

Thank you so much for your help.....

Interesting how you can do so many things with vb.net and think you are a great programmer then something like this comes up and you learn there are so many things you never knew where there.....

Thanks.
daveofgv


This thread should be considered "Answered"
 
It's a constant process of learning. ^^

I've started one and a half year ago to write code as a professional...when I started I didn't knew anything about Interfaces or class inheritance, but I've grown..and I still do learn everyday. Just some weeks ago I discovered the great ability to use Enums as Bit-Flags. I guess you actually never stop learning in this job.

Bobby
 
Back
Top