summaryrefslogtreecommitdiff
path: root/inc/auth.php
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2009-10-15 20:43:30 +0200
committerAndreas Gohr <andi@splitbrain.org>2009-10-15 20:43:30 +0200
commit43ee7484334f99fcb7122cc66ed3c831f94ff553 (patch)
tree2a352856ddc47fba71c139e98d038da174c8004e /inc/auth.php
parentc2a66484e7b39b9e9b6cd06cfe51b305a1952f3d (diff)
downloadrpg-43ee7484334f99fcb7122cc66ed3c831f94ff553.tar.gz
rpg-43ee7484334f99fcb7122cc66ed3c831f94ff553.tar.bz2
Support for kmd5 passcrypt method
Ignore-this: c809bd207504f78e84685612b0a668a7 This is a MD5 based hashing method used in the Unclassified NewsBoard forum software (which is used for DokuWiki's supprt forum) darcs-hash:20091015184330-7ad00-38680848952bdb46052dcf3597fa5e91f892ca51.gz
Diffstat (limited to 'inc/auth.php')
-rw-r--r--inc/auth.php9
1 files changed, 9 insertions, 0 deletions
diff --git a/inc/auth.php b/inc/auth.php
index 9be5c19b4..684885890 100644
--- a/inc/auth.php
+++ b/inc/auth.php
@@ -872,6 +872,7 @@ function act_resendpwd(){
* crypt - Unix crypt
* mysql - MySQL password (old method)
* my411 - MySQL 4.1.1 password
+ * kmd5 - Salted MD5 hashing as used by UNB
*
* @author Andreas Gohr <andi@splitbrain.org>
* @return string The crypted password
@@ -942,6 +943,11 @@ function auth_cryptPassword($clear,$method='',$salt=null){
return sprintf("%08x%08x", ($nr & 0x7fffffff), ($nr2 & 0x7fffffff));
case 'my411':
return '*'.sha1(pack("H*", sha1($clear)));
+ case 'kmd5':
+ $key = substr($salt, 16, 2);
+ $hash1 = strtolower(md5($key . md5($clear)));
+ $hash2 = substr($hash1, 0, 16) . $key . substr($hash1, 16);
+ return $hash2;
default:
msg("Unsupported crypt method $method",-1);
}
@@ -980,6 +986,9 @@ function auth_verifyPassword($clear,$crypt){
$method = 'mysql';
}elseif($len == 41 && $crypt[0] == '*'){
$method = 'my411';
+ }elseif($len == 34){
+ $method = 'kmd5';
+ $salt = $crypt;
}else{
$method = 'crypt';
$salt = substr($crypt,0,2);