unencrypting values

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
coindood
Forum Newbie
Posts: 11
Joined: Mon Jan 19, 2004 2:01 pm

unencrypting values

Post by coindood »

I have a function:

<?php
function Encrypt($string) {//hash then encrypt a string
$crypted = crypt(md5($string), md5($string));
return $crypted;
}
?>

and I want to unencrypt strings from a mysql database crypted with this function. how would I do that? For example, I have a login script that crypts the username and password, but to retrive the username to sort a table with a mysql query would be impossible becuase all I know is the username and not the crypted string!
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

You can't unencrypt md5.. can you?
User avatar
dull1554
Forum Regular
Posts: 680
Joined: Sat Nov 22, 2003 11:26 am
Location: 42:21:35.359N, 76:02:20.688W

Post by dull1554 »

all you have to do is collect the password through POST or....if your stupid GET, the encrypt it in the same manner as whats in the database
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Post by Roja »

I've answered a similar post once before:

viewtopic.php?p=79450#79450

Should clear things up a bit.
coindood
Forum Newbie
Posts: 11
Joined: Mon Jan 19, 2004 2:01 pm

Post by coindood »

Thanks Roja, and yes, dull, I went everywhere looking, and I'm trying to retrive the username without the person logging in for a news updates site so I can see who posted the message. And no, I'm not stoopid (sic)
User avatar
dull1554
Forum Regular
Posts: 680
Joined: Sat Nov 22, 2003 11:26 am
Location: 42:21:35.359N, 76:02:20.688W

Post by dull1554 »

i was just kidding, i was just implying that you would be stupid to process your login script with GET, i was not trying to call you stupid....just sayin
coindood
Forum Newbie
Posts: 11
Joined: Mon Jan 19, 2004 2:01 pm

Post by coindood »

:lol: Get rulez. it just |9 0 ><
Post Reply