2012-11-15
daenney
In the plain backend Dokuwiki doesn't support SHA-512 hashes.
I've currently solved it this way but it's not very charming, in inc/PassHash.class.php:
[..]
} elseif(preg_match('/^\$6\$(.{8})\$/', $hash, $m)) {
$method = 'sha512';
$salt = $m[1];
[..]
public function hash_sha512($clear, $salt) {
if (CRYPT_SHA512 != 1) {
throw new Exception('Hashing mechanism not supported.');
}
return crypt($clear, '$6$'. $salt . '$');
}
[..]
There's two flaws here:
* CRYPT_SHA512 only exists in PHP 5.3.2 or higher
* The assumption is made that the salt is 8 characters, it should match everything between $6$ and the next $