Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,472
There are 1306 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     PHP and MySQL :

Password encryption?

Thread title: Password encryption?
Closed Thread  
Page 1 of 4 1 2 3 4 >
    Thread tools Search this thread Display Modes  
02-15-2007, 09:33 AM
#1
Impluo is offline Impluo
Status: We're all mad here
Join date: Aug 2005
Location: Missouri
Expertise: programming
Software: Notepad
 
Posts: 1,606
iTrader: 0 / 0%
 

Impluo is on a distinguished road

  Old  Password encryption?

When you save passwords in a database, how much encryption should you use?

$rand = rand(0,9999);
$password = sha1((md5($password)+$rand),CRYPT);

Would something like this be enough encryption?

02-15-2007, 10:05 AM
#2
Sketch is offline Sketch
Sketch's Avatar
Status: Member
Join date: Aug 2005
Location: Melbourne, Australia
Expertise:
Software:
 
Posts: 419
iTrader: 0 / 0%
 

Sketch is on a distinguished road

  Old

Ah yer that would be more then enough, in fact it would be too much. How are you going to work out what random number you added to the record?

I usally just go md5($password);

However I've started going sha1($password); and I figure thats enough its one way encryption so it should be hard enough.

02-15-2007, 10:27 AM
#3
Impluo is offline Impluo
Status: We're all mad here
Join date: Aug 2005
Location: Missouri
Expertise: programming
Software: Notepad
 
Posts: 1,606
iTrader: 0 / 0%
 

Impluo is on a distinguished road

  Old

I keep hearing people say bad things about using sha1 or md5 alone so I didn't know how far I should actually take it

You could store the random number in the database also .

02-15-2007, 01:51 PM
#4
echoSwe is offline echoSwe
Status: Member
Join date: Jul 2005
Location:
Expertise:
Software:
 
Posts: 185
iTrader: 0 / 0%
 

echoSwe is on a distinguished road

  Old

Use SHA256/SHA2 instead of SHA128/SHA1. SHA1 has security flaws. MD5 is nothing that you should ever use, besides when doing checksums on files.

02-15-2007, 04:40 PM
#5
noodles is offline noodles
Status: Junior Member
Join date: May 2005
Location:
Expertise:
Software:
 
Posts: 44
iTrader: 0 / 0%
 

noodles is on a distinguished road

  Old

Originally Posted by echoSwe View Post
Use SHA256/SHA2 instead of SHA128/SHA1. SHA1 has security flaws. MD5 is nothing that you should ever use, besides when doing checksums on files.
hm everyone here says, you shouldn't use md5... but why? isn't it secure?

02-16-2007, 05:52 AM
#6
echoSwe is offline echoSwe
Status: Member
Join date: Jul 2005
Location:
Expertise:
Software:
 
Posts: 185
iTrader: 0 / 0%
 

echoSwe is on a distinguished road

  Old

Originally Posted by noodles View Post
hm everyone here says, you shouldn't use md5... but why? isn't it secure?
As many above said, you can simply use a rainbow table to find the corresponding password to that specific hash.

MD5 is also such a quick algorithm that it borders on when you really have to use rainbow tables and when you can use a brute-force attack.
http://eprint.iacr.org/2006/105

However, as Phaaze said. You could use key strengthening.

I can't understand why you guys still argue about MD5. I don't usually deal with PHP; but just a quick search gave me this code snippet:
PHP Code:
$phrase "Hello World";

$sha1a =  base64_encode(sha1($phrase));
$sha1b =  base64_encode(bin2hex(mhash(MHASH_SHA1,$phrase)));
$sha256bbase64_encode(bin2hex(mhash(MHASH_SHA256,$phrase)));

echo (
"SHA1..:" $sha1a "\n");
echo (
"SHA1..:" $sha1b "\n");
echo (
"SHA256:" $sha256b "\n"); 
So I mean, what's so troublesome about that, that you can't use it? It's just a line of code and then you got your SHA-2 hash ready to go! Add a known salt to that, for example a large random number that you store in the column next to the password column and concatenate to the password before hashing it all. Then brute-force attacks can only be done on one password at a time, because all passwords use a different salt. This is what makes the time required to find the password increase so much that it becomes impractical to try, just using the hardware of today.

Although I'm wondering what quantum computing will turn out like and what it will do to the area of computer security.

Lastly, hashing != encryption, because it's irreversible. Encryption is stuff like blowfish and RSA.

02-15-2007, 05:35 PM
#7
Immersion is offline Immersion
Status: Senior Member
Join date: Dec 2005
Location:
Expertise:
Software:
 
Posts: 918
iTrader: 5 / 100%
 

Immersion is on a distinguished road

  Old

there are many md5 library/ crackers now that you just add the hash and it will find wheat the word is. This generally only works with dictionary words.

02-15-2007, 06:04 PM
#8
Amross is offline Amross
Status: Member
Join date: Jan 2007
Location:
Expertise:
Software:
 
Posts: 311
iTrader: 4 / 100%
 

Amross is on a distinguished road

  Old

I don't know what type of site you're seeking encryption for, but if you're merely trying to avoid storing raw passwords on your average site, using a standard method (such as md5 or sha1) along with salting it with an unknown and random (yet static) string should be more than sufficient. There are obviously numerous stronger methods than I mentioned, but they are also less efficient and thus unless needed, wouldn't exactly be practical.

02-15-2007, 08:20 PM
#9
Zara is offline Zara
Status: Member
Join date: Apr 2006
Location:
Expertise:
Software:
 
Posts: 249
iTrader: 9 / 100%
 

Zara is on a distinguished road

  Old

I just stick with md5(md5($password)) It's pretty simple but can easily bypass most of those library's / crackers he was talkin' about...

If you have the registration timestamp in the database you can do md5(md5($password)+$reg_timestamp)

02-16-2007, 02:57 AM
#10
unclekyky is offline unclekyky
unclekyky's Avatar
Status: Junior Member
Join date: May 2005
Location:
Expertise:
Software:
 
Posts: 43
iTrader: 0 / 0%
 

unclekyky is on a distinguished road

  Old

I've heard that you shouldn't hash a hash. It (supposedly) makes the hash have a greater chance of collisions (which is a bad thing).

So doing md5(md5($p)) is not the best way to do things.

Thats what I have been told, so I'm not to sure what to do.

Closed Thread  
Page 1 of 4 1 2 3 4 >


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed