我已经有了一个web应用程序,在该应用程序中,我使用
Hash::make($string);
什么是相当于核心的php,这将帮助我的android开发人员同步我的应用程序。我试过用哈希和地窖,这不一样。帮助我编写后端,这样我的开发人员就更容易编写后端了。
发布于 2014-07-19 07:50:38
试着使用
password_hash($string);
您可以使用
password_verify($string,$hash);
希望能帮上忙!!
发布于 2014-07-19 07:58:27
我想这就是Illuminate\Hashing\BcryptHasher::make()方法。您可以检查该类的来源,以了解发生了什么:
<?php namespace Illuminate\Hashing;
class BcryptHasher implements HasherInterface {
protected $rounds = 10;
public function make($value, array $options = array())
{
$cost = isset($options['rounds']) ? $options['rounds'] : $this->rounds;
$hash = password_hash($value, PASSWORD_BCRYPT, array('cost' => $cost));
if ($hash === false)
{
throw new \RuntimeException("Bcrypt hashing not supported.");
}
return $hash;
}因此,要在核心PHP中做到这一点,您需要执行如下操作:
$string = "some string that needs to be hashed";
$hash = password_hash($string, PASSWORD_BCRYPT, array('cost' => 10));https://stackoverflow.com/questions/24838039
复制相似问题