Print Page | Close Window

hash coding password

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=14260
Printed Date: 30 March 2026 at 11:43am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: hash coding password
Posted By: riya_singtel
Subject: hash coding password
Date Posted: 16 March 2005 at 12:31am

I have a table in my access database with usernames and passwords. I want to store the passwords in encrypted form. All codes I found on the net were based on asp .net or required installing a component that had to be bought like aspEncrypt. Is there a code I can use in asp vb script to store the passwords in encrypted form?

Thanks.



Replies:
Posted By: ub3rl337ch3ch
Date Posted: 16 March 2005 at 1:03am
you could do a series of replaces when a password is entered so that it converts say, "password" to "wnggtcrs" as in replace p with w, a with n, s with g... that kind of thing. That would mean that the database would contain only nonsense passwords that someone who couldnt see the asp replace code wouldn't have the real password.
 
Something like this would do you:
 
var passwordvariable
passwordvariable = request.form("passwordfield")
passwordvariable = Replace(passwordvariable, "a", "b")
the above would replace all a's in the password with b's...
 
It would mean you would have to do a replace line of code for every single valid character... but the chances of breaking a replacement cypher on something as short as a password is fairly low.
 
You could add another level (no idea what the syntax would be, or if it is even possible - suggestions anyone) and basically have a different replacement cypher depending on the number of characters in the password, which would make it harder again if someone gt their hands on your database.
 
As for an encrypt using matrices, it would be a matter of creating a number of variables (dependant on the number of characters in the pw), assign the letters of the pw to those variables after converting them to number form, and then doing the whole matrix multiplication thing which i for the life of me can't remember. The you'd have a problem with getting the numbers to string together one after another instead of just adding up, though it is possible.
 
regardless of what type ou wanted to use if any you would just have the post-cypher password in your database. again, that assumes that you're just wanting to stop people from getting login details from looking at the db... if they could see the asp it'd just take them a few minutes to track down and determine a replace cypher. On the other hand, even if someone had the matrix cypher, they'd have to recognise the code as a vb version of a matrix, then work out the reverse cypher. Even then i they could only see one of the asp or db, it'd be no help to them.
 
I hope that at least gave you some ideas. Anything more complex than that and you'd probably need to spend more time than was worth it considering the cost of buying an encryption. That's probably the case for the matrix cypher, because that's as complex as hell, and its liekly that that is the kind of cypher that you'd be paying for with aspEncrypt, considering most (ass cover, cos there may be something new i don't know of) modern cyphers are matrix cyphers.
 
 
oh, and you'd have to do the replace when doing anything with the password, whether it be validating or creating it...


Posted By: Phat
Date Posted: 16 March 2005 at 1:22am
or check out how WWF does it.



Posted By: dj air
Date Posted: 16 March 2005 at 6:24am
i would recommend using WWF style

if the password is ok to be entered an not retriveable into its orginal state.

it encodes it in a way that you have to compare the passwords after the enterd password is encrypted, to see if both encrypted versions match if so then the password the user entered is correct .

if you want 2 way encryption i would recommend trying ub3rl337ch3c

But changeing it into P etc will also have implications because you may change A to P, but when reversing the encryption you will get a different response. you will have to decrypt it in reverse order


Posted By: Gullanian
Date Posted: 16 March 2005 at 9:31am
Best way is as DJ air stated.  Store the password in it's MD5 form (lots of free code snippets out there that do this).  Make sure to use a salt, some articles on 4guys on that.


Posted By: riya_singtel
Date Posted: 17 March 2005 at 2:20am
Thanks..I used the MD5 way and got it done



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net