/[webwml]/newmaint/common.inc
ViewVC logotype

Diff of /newmaint/common.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by csmall, Tue Dec 19 00:21:16 2000 UTC revision 1.2 by weasel, Sun Nov 18 02:31:17 2001 UTC
# Line 79  Line 79 
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    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.5