bernd commited on 2010-04-24 11:23:37
Zeige 1 geänderte Dateien mit 13 Einfügungen und 3 Löschungen.
git-svn-id: https://svn.schokokeks.org/repos/tools/webinterface/trunk@1727 87cf0b9e-d624-0410-a070-f6ee81989793
... | ... |
@@ -4,10 +4,20 @@ function encrypt_mail_password($pw) |
4 | 4 |
{ |
5 | 5 |
DEBUG("unencrypted PW: ".$pw); |
6 | 6 |
require_once('inc/base.php'); |
7 |
+ $newpass = ''; |
|
8 |
+ if (defined("CRYPT_SHA512") && CRYPT_SHA512 == 1) |
|
9 |
+ { |
|
10 |
+ $rounds = rand(1000, 5000); |
|
11 |
+ $salt = "rounds=".$rounds."$".random_string(8); |
|
12 |
+ $newpass = crypt($newpass, "\$6\${$salt}\$"); |
|
13 |
+ } |
|
14 |
+ else |
|
15 |
+ { |
|
7 | 16 |
$salt = random_string(8); |
8 |
- $encpw = crypt($pw, "\$1\${$salt}\$"); |
|
9 |
- DEBUG("encrypted PW: ".$encpw); |
|
10 |
- return chop($encpw); |
|
17 |
+ $newpass = crypt($newpass, "\$1\${$salt}\$"); |
|
18 |
+ } |
|
19 |
+ DEBUG("encrypted PW: ".$newpass); |
|
20 |
+ return chop($newpass); |
|
11 | 21 |
|
12 | 22 |
} |
13 | 23 |
|
14 | 24 |