summaryrefslogtreecommitdiff
path: root/inc/PassHash.class.php
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2011-11-27 11:11:01 +0100
committerAndreas Gohr <andi@splitbrain.org>2011-11-27 11:11:01 +0100
commit5c73ae04fa654072dbca15f016f31c68a0c7bcee (patch)
tree9bcda24a887f22b83c217810147399afdfc5c993 /inc/PassHash.class.php
parent560f6ea3cdac2767863c3be3a9e7933b6e37e88f (diff)
parentc8ca60df97ff2b24091c7c0d0db72c680200ea1b (diff)
downloadrpg-5c73ae04fa654072dbca15f016f31c68a0c7bcee.tar.gz
rpg-5c73ae04fa654072dbca15f016f31c68a0c7bcee.tar.bz2
Merge branch 'lmd5' into bcrypt
Conflicts: lib/plugins/config/settings/config.metadata.php
Diffstat (limited to 'inc/PassHash.class.php')
-rw-r--r--inc/PassHash.class.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/inc/PassHash.class.php b/inc/PassHash.class.php
index 77f2115bd..2558f37c6 100644
--- a/inc/PassHash.class.php
+++ b/inc/PassHash.class.php
@@ -53,6 +53,9 @@ class PassHash {
}elseif(substr($hash,0,6) == '{SSHA}'){
$method = 'ssha';
$salt = substr(base64_decode(substr($hash, 6)),20);
+ }elseif(substr($hash,0,6) == '{SMD5}'){
+ $method = 'lsmd5';
+ $salt = substr(base64_decode(substr($hash, 6)),16);
}elseif($len == 32){
$method = 'md5';
}elseif($len == 40){
@@ -133,6 +136,20 @@ class PassHash {
}
}
+
+ /**
+ * Password hashing method 'lsmd5'
+ *
+ * Uses salted MD5 hashs. Salt is 8 bytes long.
+ *
+ * This is the format used by LDAP.
+ */
+ public function hash_lsmd5($clear, $salt=null){
+ $this->init_salt($salt,8);
+ return "{SMD5}".base64_encode(md5($clear.$salt, true).$salt);
+ }
+
+
/**
* Password hashing method 'apr1'
*