File operations :: owncloud documentation

First, i should say that I am relatively new khổng lồ programming so please be gentle with me if this is a naive or dumb question.

You watching: File operations :: owncloud documentation

Ok, so I am in the process of writing a small application, part of which will involve hashing user passwords. After researching the best way lớn vày this, md5 appears as a suggestion, almost as many times as it appears in articles criticizing its use.

The alternatives are the likes of SHA-1 etc which are stronger & less likely to lớn be cracked. This makes perfect sense.

To get khổng lồ the point:

Why is md5 still widely used for hashingShould I automatically discount md5 for hashing passwords, or are there specific use cases where its use would actually be better than other hashing mechanisms?
php md5 security hash
Improve sầu this question
edited Jun 23 "12 at 10:11
asked Jun 23 "12 at 10:00
Add a comment |

5 Answers 5

Active Oldest Votes
Neither MD5 nor SHA-1 should be used for hashing passwords. They are designed to lớn be fast to lớn compute, which is exactly what you don"t want. If people are using these hashing algorithms for hashing passwords, it"s likely because they don"t know about alternatives.

Instead you should be using something like bcrypt that is designed specifically for this purpose. It can be configured to be as hard lớn compute as you need. As computers get faster you can just add more rounds khổng lồ the computation khổng lồ make it take longer. This will slow down attackers who get hold of the hashes và try khổng lồ use brute-force or dictionary based attacks to lớn get the passwords.


Improve this answer
edited May 23 "17 at 12:25

111 silver badge
answered Jun 23 "12 at 10:03

Mark ByersMark Byers
734k166166 gold badges15121512 silver badges14211421 bronze badges
Thanks Mark. It appears lớn be the consus among mỏi the answers that bcrypt is a better soltuion. I will investigate this as an option. Do you know if there would be performance issues on large traffic websites, using this as an authentication method for its users?
Jun 23 "12 at 10:12
Add a phản hồi |
For the same reason mysql_* functions are used, most resources và tutorials on the web are outdated with information, causing newbie programmers use them blindly (because the tutorial said so!).

I don"t blame the new programmers, I blame the tutorial makers for not updating their tutorials. Google"s tìm kiếm algorithm also usually takes age inkhổng lồ account, and displays older entries higher in the search result.

See more: Cách Bật Nút Theo Dõi Trên Facebook Trang Cá Nhân Bằng Điện Thoại

As for alternatives, I believe sầu Mark Byers said it better than I can.

Improve this answer
answered Jun 23 "12 at 10:05

Madara's GhostMadara's Ghost
161k4949 gold badges246246 silver badges296296 bronze badges
Add a comment |
MD5 is still reasonably safe lớn use for most cases<*>, so long as you use a good "salt" lớn phối in with the actual password before it"s encrypted.

There is still no known way other than brute force khổng lồ accomplish a "first pre-image attack" on MD5, i.e. given a hash, figure out what the original password was.

The "salt" mentioned above sầu is necessary lớn ensure that your encrypted passwords can"t be trivially looked up in a "rainbow table" or other existing lists of "string khổng lồ digest".

The recent Linked-In password leak is a good example of why salt is important. They failed to lớn salternative text their users" passwords, so many of the passwords were trivially reversed because the hashes of those passwords are already computed (& in many cases found via Google).

What you still shouldn"t do though is have sầu the salt itself easily determined. If the attacker can work out what the salt is all bets are off, because then the brute force mechanisms described in the article posted by Florian become available again. A good salternative text should be long, và you shouldn"t use the same salternative text for every user.

See more: Cách Khắc Phục Lỗi Chữ Trên Màn Hình Máy Tính Bị Mờ Trong Windows 10

The only true weaknesses so far found in MD5 itself have been ways khổng lồ produce a new tệp tin which manages lớn result in the same MD5 digest as another file, when you already know the contents of the original file. This is known as a "second pre-image attack", và is irrelevant when considering the use of a hashing algorithm for password encryption.

All that said, if a better algorithm (SHA-2, bcrypt) is available, you might as well use it!

Chuyên mục: Chia sẻ