__bc_crypt 的php转换

<?php


$plain = '123456'.'2bed6aeceef9c65ce5ae91725927b203e907dcb4df0b63fde0329cad97d1e7cfb96532632ee84d7f61ed49606c31a8b381b97bd250fbb6c0470c8a9a396b65be';
$options = [
    'cost' => 10,
    'salt' => '$2a$10$W5sI0xJSsIzDLRmXLnes/e',
];

echo password_hash($plain, PASSWORD_BCRYPT, $options);
echo "\n";

$salt = '$2a$10$W5sI0xJSsIzDLRmXLnes/e';
echo crypt($plain, $salt);
echo "\n";

 

 

__bc_crypt '123456'+'2bed6aeceef9c65ce5ae91725927b203e907dcb4df0b63fde0329cad97d1e7cfb96532632ee84d7f61ed49606c31a8b381b97bd250fbb6c0470c8a9a396b65be', '$2a$10$W5sI0xJSsIzDLRmXLnes/e', 10

 

 

参考 http://php.net/manual/zh/function.password-hash.php

https://github.com/codahale/bcrypt-ruby/blob/rel_2_1_2/lib/bcrypt.rb#L50

 

 

https://github.com/plataformatec/devise/blob/v1.1.2/lib/devise/encryptors/bcrypt.rb#L11

你可能感兴趣的:(PHP)