| 79 |
echo $falseflag; |
echo $falseflag; |
| 80 |
} |
} |
| 81 |
} |
} |
| 82 |
|
|
| 83 |
|
# Those two functions are currently needed in the gpg signing coordination part |
| 84 |
|
# I took the liberty to add them here as they might be useful for other parts of |
| 85 |
|
# the page too. |
| 86 |
|
function passwd_crypt($passwd) |
| 87 |
|
{ |
| 88 |
|
static $initialized = 0; |
| 89 |
|
|
| 90 |
|
if (! $initialized ) { |
| 91 |
|
srand((double)microtime()*1000000); |
| 92 |
|
$initialized=1; |
| 93 |
|
}; |
| 94 |
|
$salt = '$1$'; |
| 95 |
|
$itoa64="./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; |
| 96 |
|
# FIXME: What kind of characters are allowed in salts? Is there a better way |
| 97 |
|
# to create one? |
| 98 |
|
# And no, php's crypt() funktion does not work without salt. At least |
| 99 |
|
# it didn't for me. |
| 100 |
|
|
| 101 |
|
$random=rand(); $salt .= substr($itoa64,$random % 64,1).substr($itoa64,($random/64) % 64,1); |
| 102 |
|
$random=rand(); $salt .= substr($itoa64,$random % 64,1).substr($itoa64,($random/64) % 64,1); |
| 103 |
|
$random=rand(); $salt .= substr($itoa64,$random % 64,1).substr($itoa64,($random/64) % 64,1); |
| 104 |
|
$random=rand(); $salt .= substr($itoa64,$random % 64,1).substr($itoa64,($random/64) % 64,1); |
| 105 |
|
return crypt($passwd, $salt); |
| 106 |
|
} |
| 107 |
|
function passwd_verify($stored_passwd, $guess) |
| 108 |
|
{ |
| 109 |
|
$salt = substr($stored_passwd, 0, 12); |
| 110 |
|
$crypted_passwd = crypt($guess, $salt); |
| 111 |
|
return ($stored_passwd == $crypted_passwd); |
| 112 |
|
} |
| 113 |
?> |
?> |
| 114 |
|
|