Jump to content

[SOLVED] md5 or sha1


Bendude14

Recommended Posts

As long as you salt, either should be fine for your purposes.

 

Both are hashes, not an encryption method. Therefore, they cannot be decrypted. Rainbow tables can be used to do a reverse lookup, however. This is why you need your salt. Salting (the process of putting extra characters in a password before hashing) will make pre-computed rainbow tables useless.

 

To give an answer, SHA1 is probably more secure. It produces a longer hash and is also less likely to produce collisions.

Link to comment
Share on other sites

SHA1, by design, is "more secure" than MD5. However, as GingerRobot mentioned, both are vulnerable to certain attacks.

 

Do look up how to correctly 'salt' a saved/stored SHA1 hash.

 

If you're securing people's data, it's important to understand what and why you're using some solution over another... not simply 'which is better?'.  Take your time figuring this one out. It'll be worth it.

 

 

Link to comment
Share on other sites

MD5 - 128 bit

SHA1 - 160 bit, i believe.

 

Both are considered insecure... MD5 in 1994, SHA-1 in 2005. Appending a random salt to these algorithms ( and using the salt to compute the hash as well ) will result in a very, very secure method of storage though, regardless of the algorithm you choose.

 

Here's a great article

 

http://phpsec.org/articles/2005/password-hashing.html

Link to comment
Share on other sites

Thanks for all the replies. I found that article with a bit of searching on google.

 

Ive decided to go for the sha1 and use a salt as well.

 

I will do some research on correctly implementing this even though i presumed it would be pretty straight forward

<?php

   $pwd = $_POST['pwd'];
   $pwd = sha1($pwd.$salt);
?>

 

I was thinking something like this would work fine

Link to comment
Share on other sites

I used SHA1 before but now I use MD5... though they don't present any problems as long as they were salted, properly that is. Also, RT has some sort of limitations, I mean the limitation is caused by the very big space required to your HDD.

 

I selected MD5 for now since it eats up lesser space compared to SHA1. Just salt it properly. :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.