diff options
author | Patrick Michel <public@pbmichel.de> | 2011-11-27 10:55:27 +0100 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2011-11-27 10:55:27 +0100 |
commit | 502a92e072be7b42750b4c9032e7269d1fd7c7b4 (patch) | |
tree | 9fccf993ebed2bda0ecb0e6e8bf70d802d3e54b8 /inc | |
parent | c66c7229a0dfc4f9f06dadda98408679fa7a18d6 (diff) | |
download | rpg-502a92e072be7b42750b4c9032e7269d1fd7c7b4.tar.gz rpg-502a92e072be7b42750b4c9032e7269d1fd7c7b4.tar.bz2 |
MD5 password hash format of the LDAP RFC FS#2378
This implements the salted MD5 password hash format of the LDAP RFC.
The format is quite simple the password, followed by the 8 byte hash in
base64 encoding, which results in 32 characters, prepended with the
string "{smd5}".
Diffstat (limited to 'inc')
-rw-r--r-- | inc/PassHash.class.php | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/inc/PassHash.class.php b/inc/PassHash.class.php index 31493c022..c13cf4a54 100644 --- a/inc/PassHash.class.php +++ b/inc/PassHash.class.php @@ -50,6 +50,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 = 'smd6'; + $salt = substr(base64_decode(substr($hash, 6)),16); }elseif($len == 32){ $method = 'md5'; }elseif($len == 40){ @@ -130,6 +133,18 @@ class PassHash { } } + + /** + * Password hashing method 'smd6' + * + * Uses salted MD5 hashs. Salt is 8 bytes long. Yes, really 8 bytes... + */ + public function hash_smd6($clear, $salt=null){ + $this->init_salt($salt,8); + return "{SMD5}".base64_encode(md5($clear.$salt, true).$salt); + } + + /** * Password hashing method 'apr1' * |