Jump to content

Which encrpytion method should I use?


jordanwb

Recommended Posts

In my site I do a simple MD5 hash of the user's password and test it against the saved password. Now given enough time it is possible to break MD5 via Collision (I actually made a C# program to do this*). I've heard of SHA256, and SHA512 but I can't find a PHP function to do that. I've also heard of Salt, what's that? My main question is what encryption methods do you prefer and what are the benefits over plain md5? Any do's and don'ts regarding certain encryption methods?

 

* But it took me several hours to break a 5 letter password.

Link to comment
https://forums.phpfreaks.com/topic/98717-which-encrpytion-method-should-i-use/
Share on other sites

I found out what Salt is but I have an issue with that. Given code:

 


function l33t_hash ($password, $salt)
{
return md5 ($salt.$password.$salt);
}

 

The value that's passed into MD5 is incredibly long. But you would need to save the value of $salt in the database. Wouldn't this be a bit of a security problem? I ask this because if you can get the result of the hash you could get the salt and figure out how the salt and original password work together. So I don't see how I would benefit except by making Rainbow Tables almost useless.

me either :D i dont understand my self sometimes=]

 

but uh i was saying if someone forgets there password in MD5 theres no way to retrive it you would have to generate them a new one.  with encrypt you can use the decrypt to give them it back

Use Mcrypt. It is a Rijndael 256 bit encryption. Very secure.

 

Function based code: http://www.w3courses.com/index.php?subaction=showfull&id=1206924756&ucat=12&category=12&catdisplay=PHP

 

Class based code: http://www.w3courses.com/index.php?subaction=showfull&id=1206924912&ucat=12&category=12&catdisplay=PHP

 

The above code will let you encrypt or decrypt the text by calling functions or class methods.

In the first link, the page has a decrpyt method which sounds instantly like a security problem.

 

Not if you are using a long and hard to guess key. You need the key and the decrpyt function to decrypt the text. The function by itself won't decrypt the data unless you have the right key.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.