| Welcome to Webforumz.com. |
|
Jan 2nd, 2008, 06:43
|
#1 (permalink)
|
|
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,567
|
[SOLVED] Encrypted Password
I don't know if this is done through server side scripting (ASP/PHP) or maybe Javascript, but since this forum (PHP) is so popular, I posted it here to get some fast feedback
Ok, I have downloaded an ASP Forum from Web Wiz Guide and I went behind the forum code to see how they coded some "thing". It came to my attention to see how they manage to do the Encrypted Password.
Situation:
When we successfully register to the system (Username & Password), and went to the database to see the password field, all I can see is some numbers and alphabets combination.
My password is: monie, but in the database it displays this:
BC2BFC83DBD77018D12B980BE82933332B99977A
This is really a secure way of storing a password! Even the Admin guy of the forum doesn't know the user password!
So my typical simple direct question is, How to do that?
Thanks in advance.
Cheers...
__________________
|
|
|
Jan 2nd, 2008, 06:51
|
#2 (permalink)
|
Join Date: Sep 2007
Location: Australia
Age: 24
Posts: 980
|
Re: Encrypted Password
That "Hash" it.
Basically hashing is a one-way encryption method.. The most popular are MD5 SHA1 and SHA2..
They take a string and encrypt it into a uniform length..... Most scripting languages include an implementation of these algorithms...
MySQL has it as a password function
- Code: Select all
INSERT INTO table VALUES (PASSWORD('monie'), username)
PHP makes it even easier
- PHP: Select all
$hash = md5('monie');
$hash = sha1('monie');
I assume ASP has one as well
It will not be retrievable....
|
|
|
Jan 2nd, 2008, 07:02
|
#3 (permalink)
|
|
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,567
|
Re: Encrypted Password
Thanks Rakuli.
That means we need to Encrypt the password before saving them to the database, right?
What about the login page, will the password field recognize the Encrypted password?
Or do we need to Decrypt them?
Thanks.
__________________
|
|
|
Jan 2nd, 2008, 07:05
|
#4 (permalink)
|
Join Date: Sep 2007
Location: Australia
Age: 24
Posts: 980
|
Re: Encrypted Password
You can never actually decrypt them, it is one way only.
When you are checking passwords, you are comparing hashes rather than passwords. You has the password first and the check it against the database value.
in mysql this would be
- Code: Select all
SELECT username FROM table WHERE password = PASSWORD('monie')
Or in PHP
- PHP: Select all
if (md5('monie') == $password)
echo 'Password is okay!';
|
|
|
Jan 2nd, 2008, 07:18
|
#5 (permalink)
|
|
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,567
|
Re: Encrypted Password
OK, let me search for the ASP Hash Algorithm first
EDIT: Found it, using MD5. I will look into it tonight. Thanks Rakuli! I'll get back to you ASAP 
__________________
Last edited by Monie; Jan 2nd, 2008 at 08:04.
|
|
|
Jan 3rd, 2008, 00:41
|
#6 (permalink)
|
|
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,567
|
Re: Encrypted Password
Ok, I manage to do it using MD5. What you need to do is download the MD5.asp file and include then on top of your page (verify page and register form page)
- HTML: Select all
<!--#include file="MD5.asp"-->
..
..
Password = MD5(Request.Form("txtPassword"))
Thanks Rakuli 
Cheers...
P/S: Could you move this thread to ASP? Thanks.
__________________
|
|
|
Jan 3rd, 2008, 00:48
|
#7 (permalink)
|
|
Administrator
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 4,102
|
Re: Encrypted Password
ASP has hardly any built in functions!
You'd probably have to download like 200 files to get the functions for a forum.
__________________
Languages: PHP, mySQL (queries), C#, (X)html, CSS, JS.
|
|
|
Jan 3rd, 2008, 01:18
|
#8 (permalink)
|
|
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,567
|
Re: Encrypted Password
As a matter of fact, ASP do have some built in function! Hai Alex. Just want to ask you 
Do you mean when using MD5 in PHP, you just use the md5(textHere)? No other file needed? Include?
Cool..
__________________
|
|
|
Jan 3rd, 2008, 01:41
|
#9 (permalink)
|
|
Administrator
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 4,102
|
Re: Encrypted Password
Yes you can do that, among a few other encryption functions.
Thanks for those links though!
__________________
Languages: PHP, mySQL (queries), C#, (X)html, CSS, JS.
|
|
|
Jan 3rd, 2008, 01:55
|
#10 (permalink)
|
|
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,567
|
Re: Encrypted Password
Cool...
In asp you need to download one asp file, named md5.asp (few hundred lines of code) just to use the MD5 Algorithm!
__________________
|
|
|
Jan 3rd, 2008, 02:56
|
#11 (permalink)
|
Join Date: Sep 2007
Location: Australia
Age: 24
Posts: 980
|
Re: Encrypted Password
Quote:
Cool...
In asp you need to download one asp file, named md5.asp (few hundred lines of code) just to use the MD5 Algorithm!
|
It takes the same amount of lines but PHP is open source and md5 was long ago built into the core of the Zend Engine... ASP evolution is somewhat slower.
|
|
|
Jan 3rd, 2008, 03:06
|
#12 (permalink)
|
|
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,567
|
Re: Encrypted Password
This encrypted password cannot be reversed engineered, aren't they?
__________________
|
|
|
Jan 3rd, 2008, 03:18
|
#13 (permalink)
|
|
Administrator
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 4,102
|
Re: Encrypted Password
Md5 is one way yes. It cannot be reversed.
__________________
Languages: PHP, mySQL (queries), C#, (X)html, CSS, JS.
|
|
|
Jan 3rd, 2008, 03:40
|
#14 (permalink)
|
|
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,567
|
Re: Encrypted Password
Nice!
Thanks Alex!
Thanks Rakuli!
Cheers..
__________________
|
|
|
| Thread Tools |
|
|
| Rate This Thread |
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|