Jump to content

Recommended Posts

I would say that 12 rounds of blowfish with a salt generated by openssl_pseudo_random_bytes or mcrypt_create_iv for strong entropy should work fine... But remember. Nothing is stronger than its weakest link. So don't forget to enforce good password rules as well

this is my way

public function cleared($data)
      {
	  $data = trim(htmlentities(strip_tags($data)));
	    if(get_magic_quotes_gpc())
	      {
		$data = stripslashes($data);
		$data = mysql_real_escape_string($data);
	      }
	return $data;
       }

public function set_post()
       {
	 foreach($_POST as $key => $values)
	     {
		$my_POST[$key] = $this->cleared($values);
	     }
	
       }

    $pass = $this->set_post(substr(sha1($this->set_post->$my_POST['pass']),18,7);

public function login_()
       {

	$cheked_user->set_result("SELECT pass FROM tbl_user_ WHERE pass = '$pass'");

       }

This is what I use:

 

0. Sanitise input. addslashes() or whatever you like. If someone would like HTML code as password - why not?

1. Generate a salt, with something like $salt = hash('sha256', microtime());

2. Add salt to the chosen password. $password = $input_password.$salt;

3. Hash it. $pass_hash = hash('sha256', $password);

4. Store $pass_hash and $salt.

 

Hashing protects you if someone dumps your user database. Don't forget the UNENCRYPTED TRANSFER of password...  webmasters normally ignores the importance of buying a valid SSL certificate.

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.