General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old February 15th, 2003, 08:44 PM
wareseeker wareseeker is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Posts: 71 wareseeker User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 7 sec
Reputation Power: 6
Help me on md5()

Please someone can help me about the md5() function?

I just don't know how to convert the password back to text.
For instance, users signup and submit their password, then the password is encrypted into 32 characters and saved into database.

How can I convert this incrypted password and then bring it back to the text to display on a form after users logged in?

Thank you very much in advanced.

Reply With Quote
  #2  
Old February 15th, 2003, 11:44 PM
laidbak laidbak is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Location: In Tha IE -- San Bernardino COUNTY
Posts: 788 laidbak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 4 m 2 sec
Reputation Power: 7
Send a message via ICQ to laidbak Send a message via AIM to laidbak Send a message via MSN to laidbak Send a message via Yahoo to laidbak
md5 is a one way function. This means you can't turn the data back into a readable string.

You need to use base64_decode and base64_encode if you want to do that.

--
Wil Moore III
www.wilmoore.com

Reply With Quote
  #3  
Old February 19th, 2003, 09:56 PM
Chunks Chunks is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Location: Australia
Posts: 6 Chunks User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
look at next post for my reply...... double post by mistake

Last edited by Chunks : February 19th, 2003 at 10:02 PM.

Reply With Quote
  #4  
Old February 19th, 2003, 10:00 PM
Chunks Chunks is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Location: Australia
Posts: 6 Chunks User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hi,

the md5() function converts a string or data file into 32 alphanumeric character representation, and as already mentioned you can't convert it back. what you can do though is compare two outputs to see if they are the same. i use this in my login system, i convert the password that the user enters in at point of login , then i check that against the already converted (md5()) password stored in my database.

eg..

PHP Code:
<?php

if( $dbpasswrd == $loginpasswrd)
{
//grant user access
}
else
{
//block user access
}
?>


hope this helps
Regards
Chunks

Reply With Quote
  #5  
Old February 20th, 2003, 08:53 AM
wareseeker wareseeker is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Posts: 71 wareseeker User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 7 sec
Reputation Power: 6
Thank you very much for all your help. I think there is no way that I can display the actual password in the Members Area everytime user login.

About this method, I don't know how to do it. Please be more detail.
PHP Code:
<?php

if( $dbpasswrd == $loginpasswrd)
{
//grant user access
}
else
{
//block user access
}
?>

Thanks

Reply With Quote
  #6  
Old February 20th, 2003, 08:58 AM
Taelo Taelo is offline
5B's
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: PC, FL
Posts: 364 Taelo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 48 m 26 sec
Reputation Power: 6
what he is saying is,....when you user was added/created you you stored an md5 password in your db right?

well do something like this,...

PHP Code:
 $get_user mysql_query("SELECT login, password FROM users WHERE password = '" md5($_POST['password'] . "' "); 


See where this is going?
__________________
-- Jason

Reply With Quote
  #7  
Old February 20th, 2003, 06:45 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Quote:
Originally posted by wareseeker
Thank you very much for all your help. I think there is no way that I can display the actual password in the Members Area everytime user login.

About this method, I don't know how to do it. Please be more detail.
PHP Code:
<?php

if( $dbpasswrd == $loginpasswrd)
{
//grant user access
}
else
{
//block user access
}
?>

Thanks


if is a conditional statement. If the condition returns true then the first block of code is run, else if the condition false the second block runs: for example

if(dog == dog)
{
echo "dog is equal to dog";
}
else
{
//this will not run
}

because dog equals dog, it will return true and run the code.

Reply With Quote
  #8  
Old February 21st, 2003, 06:51 AM
ZaireWeb ZaireWeb is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Hamburg, NY
Posts: 37 ZaireWeb User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to ZaireWeb Send a message via AIM to ZaireWeb
He is saying he wants to display the user's password after login.. that's deffinitly bad security wise..

Why bother using MD5 if your going to do that then? If you need to do it incase users forget there passwords, just write a script that will re-assign them a new password.
__________________
Eric Coleman - Co-Owner ZaireWeb Solutions
eric.coleman@zaireweb.com
http://sitemod.net - sitemodCMS Coming Soon!

Reply With Quote
  #9  
Old February 21st, 2003, 03:30 PM
nicat23's Avatar
nicat23 nicat23 is offline
Addicted to Chaos..
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jan 2003
Location: Ft. Worth, TX
Posts: 653 nicat23 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 47 m 52 sec
Reputation Power: 0
Send a message via AIM to nicat23 Send a message via Yahoo to nicat23
The only way that you could encrypt the password and be able to decrypt it would either to write your own encryption algorythm that can be decrypted by another function you write, or, you can try using the mcrypt functionality: http://www.php.net/manual/en/ref.mcrypt.php

I can't see why you would really want to show the plain text password of a user, that's extremely bad security, unless you're using it for debugging, and even then you can just md5 the password and compare it to the database <as mentioned above> which would be a much better debugging method, that way you don't compromise the security of the users...

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Help me on md5()


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway