当我在 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 之外,所有结果怎么可能相同?我认为盐的最轻微变化会产生完全不同的结果。