MD5 hash passwords

Page 1 of 1

4 Replies - 849 Views - Last Post: 29 March 2015 - 08:52 PM

#1 no2pencil  Icon User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6544
  • View blog
  • Posts: 30,651
  • Joined: 10-May 07

MD5 hash passwords

Posted 18 December 2007 - 06:37 PM

Description: Don't leave your passwords laying around for others to find. MD5 has them into a database (or other storage) & compare the results.
function login() {
	$err=2;
	if(isset($_POST['username'])) {
		$username=$_POST['username'];
		$err--;
	}
	if(isset($_POST['password'])) {
		$password=md5($_POST['password']);
		$err--;
	}
	if($err!=0) {
		die("Required fields were not supplied");
	}
	$query = "SELECT COUNT(*) FROM customer WHERE LOGINNAME ='{$username}' AND PASSWORD='{$password}';";
	$sql = mysql_query($query) or die(mysql_error());
}


Is This A Good Question/Topic? 0
  • +

Replies To: MD5 hash passwords

#2 coaster3000  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 1
  • View blog
  • Posts: 99
  • Joined: 28-August 08

Re: MD5 hash passwords

Posted 04 January 2010 - 02:57 PM

how do i use this? how do i encrypt it does the md5 function encrypt / decrypt because i need this to encrypt register passes and then decrypt to check if they log in with correct details :) thanks wait i see how it works i believe :) thanks ill message you if i need help
Was This Post Helpful? 0
  • +
  • -

#3 no2pencil  Icon User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6544
  • View blog
  • Posts: 30,651
  • Joined: 10-May 07

Re: MD5 hash passwords

Posted 07 October 2010 - 01:19 AM

md5 is not encryption, it's hashing the value. You can only one way hash, meaning you can not retrieve the original value from the hash. To compare passwords you md5 hash the given value by the user & compare the string in the database (which is a hash) to the hashed value of the user provided password string. You always compare hashes, never original values. Remember, md5 is NOT encryption!
Was This Post Helpful? 0
  • +
  • -

#4 macosxnerd101  Icon User is online

  • Games, Graphs, and Auctions
  • member icon




Reputation: 12135
  • View blog
  • Posts: 45,119
  • Joined: 27-December 08

Re: MD5 hash passwords

Posted 15 January 2015 - 12:15 AM

Based on this link, I would encourage a hash function other than MD5.
Was This Post Helpful? 0
  • +
  • -

#5 benanamen  Icon User is offline

  • D.I.C Head

Reputation: 13
  • View blog
  • Posts: 120
  • Joined: 28-March 15

Re: MD5 hash passwords

Posted 29 March 2015 - 08:52 PM

MD5 is not secure. Do not use this code. Use Bcrypt.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1