summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--_test/cases/inc/auth_password.test.php4
-rw-r--r--inc/PassHash.class.php10
2 files changed, 8 insertions, 6 deletions
diff --git a/_test/cases/inc/auth_password.test.php b/_test/cases/inc/auth_password.test.php
index d19b2a0e7..1c0942239 100644
--- a/_test/cases/inc/auth_password.test.php
+++ b/_test/cases/inc/auth_password.test.php
@@ -18,8 +18,8 @@ class auth_password_test extends UnitTestCase {
'kmd5' => 'a579299436d7969791189acadd86fcb716',
'pmd5' => '$P$abcdefgh1RC6Fd32heUzl7EYCG9uGw.',
'hmd5' => '$H$abcdefgh1ZbJodHxmeXVAhEzTG7IAp.',
- 'djangomd5' => '$md5$abcde$d0fdddeda8cd92725d2b54148ac09158',
- 'djangosha1' => '$sha1$abcde$c8e65a7f0acc9158843048a53dcc5a6bc4d17678',
+ 'djangomd5' => 'md5$abcde$d0fdddeda8cd92725d2b54148ac09158',
+ 'djangosha1' => 'sha1$abcde$c8e65a7f0acc9158843048a53dcc5a6bc4d17678',
);
diff --git a/inc/PassHash.class.php b/inc/PassHash.class.php
index dce1a5ace..c4a6d78d0 100644
--- a/inc/PassHash.class.php
+++ b/inc/PassHash.class.php
@@ -41,10 +41,10 @@ class PassHash {
$method = 'pmd5';
$salt = $m[1];
$magic = 'H';
- }elseif(preg_match('/^\$sha1\$(.{5})\$/',$hash,$m)){
+ }elseif(preg_match('/^sha1\$(.{5})\$/',$hash,$m)){
$method = 'djangosha1';
$salt = $m[1];
- }elseif(preg_match('/^\$md5\$(.{5})\$/',$hash,$m)){
+ }elseif(preg_match('/^md5\$(.{5})\$/',$hash,$m)){
$method = 'djangomd5';
$salt = $m[1];
}elseif(substr($hash,0,6) == '{SSHA}'){
@@ -348,13 +348,14 @@ class PassHash {
* Uses salted SHA1 hashs. Salt is 5 bytes long.
* This is used by the Django Python framework
*
+ * @link http://docs.djangoproject.com/en/dev/topics/auth/#passwords
* @param string $clear - the clear text to hash
* @param string $salt - the salt to use, null for random
* @returns string - hashed password
*/
public function hash_djangosha1($clear, $salt=null){
$this->init_salt($salt,5);
- return '$sha1$'.$salt.'$'.sha1($salt.$clear);
+ return 'sha1$'.$salt.'$'.sha1($salt.$clear);
}
/**
@@ -363,13 +364,14 @@ class PassHash {
* Uses salted MD5 hashs. Salt is 5 bytes long.
* This is used by the Django Python framework
*
+ * @link http://docs.djangoproject.com/en/dev/topics/auth/#passwords
* @param string $clear - the clear text to hash
* @param string $salt - the salt to use, null for random
* @returns string - hashed password
*/
public function hash_djangomd5($clear, $salt=null){
$this->init_salt($salt,5);
- return '$md5$'.$salt.'$'.md5($salt.$clear);
+ return 'md5$'.$salt.'$'.md5($salt.$clear);
}
}