doulei6330
2013-10-26 10:52
浏览 87
已采纳

如何使用codeigniter正确实现PHPass密码hasher?

I'm struggling to correctly execute a password hash in codeigniter using phpass. I have added the phpass password hash file to the libraries folder in codeigniter, and now I don't know how to correctly write the statement $t_hasher = new PasswordHash(8, FALSE); ? Can you guys help with the correct syntax? Here's what I have so far:

function passwordTry() 
{
    $this->load->library('PasswordHash', 'null', 'passHash');
    $hasher = new $this->passHash->PasswordHash(8, FALSE);
    $hash = $hasher->HashPassword('abcd');
    echo ($hash);
    }
  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • duanjiao3754 2013-10-26 11:01
    已采纳
     $this->load->library('PasswordHash',array('iteration_count_log2' => 8, 'portable_hashes' => FALSE ), 'passHash');
     $secure_password = $this->passHash->CheckPassword($this->input->post('password'),$pass['password']);
    
    echo $secure_password;
    
    已采纳该答案
    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题