[pmwiki-devel] crypt problem on WAMP

Dominique Faure dominique.faure at gmail.com
Fri Jun 4 09:41:36 CDT 2010


On Fri, Jun 4, 2010 at 15:41, Peter Bowers <pbowers at pobox.com> wrote:
> On Fri, Jun 4, 2010 at 3:33 PM, Eemeli Aro <eemeli at gmail.com> wrote:
>> On 4 June 2010 16:29, Dominique Faure <dominique.faure at gmail.com> wrote:
>>> As a workaround, have you tried to use the _crypt(...) version defined
>>> in scripts/authuser.php ?
>>
>> Gives the same results. With hashes that start '$1$', internally
>> _crypt() just calls crypt() with the same parameters it's passed.
>
> Confirmed.  I actually started with calls to _crypt() and then tried
> to simplify my config.php by not including authuser.php or any other
> scripts and still got the same result with crypt() directly.

I ran the following code under different PHP version on the same Vista
host and there seems to be severe php bugs on Windows :(
Feel free to open a bug report using these results.

<?php
echo "local config: " . PHP_VERSION . "\n";
echo "CRYPT_SALT_LENGTH: " . CRYPT_SALT_LENGTH . "\n";
$hash0 = crypt('abc');
$salt0 = substr($hash0, 0, CRYPT_SALT_LENGTH);
$salt1 = preg_replace("/[^$]+$/", "", $hash0);
echo "
hash0=$hash0 (initial hash)
salt0=$salt0 (salt as specified)
salt1=$salt1 (salt extracted)
";

$hash1 = crypt('abc', $hash0);
$hash2 = crypt('abc', $salt0);
$hash3 = crypt('abc', $salt1);
echo "
hash1=$hash1 (full hash)
hash2=$hash2 (salt as specified)
hash3=$hash3 (salt extracted)
";
=====
D:\WebOnKey\phpbatch>phpbatch.cmd crypt_test.php
local config: 5.2.11
CRYPT_SALT_LENGTH: 12

hash0=$1$QB3.ZN1.$5tkZ7UCuwUjYqq2Z3Ta6B0 (initial hash)
salt0=$1$QB3.ZN1.$ (salt as specified)
salt1=$1$QB3.ZN1.$ (salt extracted)

hash1=$1$QB3.ZN1.$5tkZ7UCuwUjYqq2Z3Ta6B0 (full hash)
hash2=$1$QB3.ZN1.$5tkZ7UCuwUjYqq2Z3Ta6B0 (salt as specified)
hash3=$1$QB3.ZN1.$5tkZ7UCuwUjYqq2Z3Ta6B0 (salt extracted)
=====
D:\WebOnKey\phpbatch>phpbatch.cmd crypt_test.php
local config: 5.3.0
CRYPT_SALT_LENGTH: 60

hash0=$1$5l3.ol/.$AXA9xtue/DFFPGTW4haT90 (initial hash)
salt0=$1$5l3.ol/.$AXA9xtue/DFFPGTW4haT90 (salt as specified)
salt1=$1$5l3.ol/.$ (salt extracted)

hash1=$1$5l3.ol/.$xaIezL3QmvNqsDx2YF/0O/ (full hash)
hash2=$1$5l3.ol/.$i3zfzb8ps1gYRpuU.yUnI1 (salt as specified)
hash3=$1$5l3.ol/.$AG4.yHS4uBrbKbrv9xK.i1 (salt extracted)

=====
D:\WebOnKey\phpbatch>phpbatch.cmd crypt_test.php
local config: 5.3.2
CRYPT_SALT_LENGTH: 123

hash0=$1$8r/.vg4.$mN8JfO5qXyCVZaGKgQpjr. (initial hash)
salt0=$1$8r/.vg4.$mN8JfO5qXyCVZaGKgQpjr. (salt as specified)
salt1=$1$8r/.vg4.$ (salt extracted)

hash1=$1$8r/.vg4.$E.2nI.Am1ykwMEY6QrB4j/ (full hash)
hash2=$1$8r/.vg4.$kpuyMfqpfu5GEeDq39lP4. (salt as specified)
hash3=$1$8r/.vg4.$qnc1GGeOQWNdfqLi2C1qD1 (salt extracted)

-- 
Dominique



More information about the pmwiki-devel mailing list