PHP で次のスクリプトを実行すると:
$hash1 = crypt('test','$2a$08$useasillystringforsalt$');<br/>
echo 'hash1:'.$hash1.'<br/>';
$hash2 = crypt('test','$2a$08$useasillystringforsaley3TiRUWCAPaejcvjzQFYCRitqtaPur6');<br/>
echo 'hash2: '.$hash2.'<br/>';
$hash3 = crypt('test','$2a$08$useasillystringforsaley3TiRUWCAPaejcvjzQFYCRitqtaPur6');
<br/>
echo 'hash3: '.$hash3.'<br/>';
$hash4 = crypt('test','$2a$08$useasillystringforsalfaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
<br/>
echo 'hash4: '.$hash4.'<br/>';
$hash5 = crypt('test','$2a$08$useasillystringforsaldaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
<br/>
echo 'hash5: '.$hash5.'<br/>';
$hash6 = crypt('test','$2a$08$useasillystringforsaleaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
<br/>
echo 'hash6: '.$hash6.'<br/>';
次の結果が得られます。
hash1: $2a$08$useasillystringforsaley3TiRUWCAPaejcvjzQFYCRitqtaPur6
<br/>
hash2: $2a$08$useasillystringforsaley3TiRUWCAPaejcvjzQFYCRitqtaPur6
<br/>
hash3: $2a$08$useasillystringforsaley3TiRUWCAPaejcvjzQFYCRitqtaPur6
<br/>
hash4: $2a$08$useasillystringforsaley3TiRUWCAPaejcvjzQFYCRitqtaPur6
<br/>
hash5: $2a$08$useasillystringforsalOnUtWGdo1WqxrpPXy7Lrt0SHVxn5XeU6
<br/>
hash6: $2a$08$useasillystringforsaley3TiRUWCAPaejcvjzQFYCRitqtaPur6
hash1 は次の結果です。
crypt('test',$2a$08$useasillystringforsalt);
私の質問は:
hash5 を除いてすべての結果が同じになるにはどうすればよいでしょうか? 塩分が少し変わるだけで全然違う結果になると思いました。