Odyssey
cu_pass.i
1 <?php
2 function compute_salt($newstyle) {
3  if ($newstyle) {
4  $salt = "_" . randchar(1) . "a.." . randchar(4);
5  } else {
6  $salt = randchar(2);
7  }
8  return $salt;
9 }
10 #
11 # return $count random characters
12 function randchar($count){
13  $str = "";
14  $enc =
15  "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
16  while ($count--) {
17  # 64 = length($enc) in call to rand() below
18  $str .= substr($enc,intval(rand(0,63)),1);
19  }
20  return $str;
21 }
22 function makesaltMD5() {
23  $saltlen=8; $saltprefix='$1$'; $saltsuffix='$';
24  $salt='';
25  while($saltlen--) $salt.=chr(rand(64,126));
26  return $saltprefix.$salt.$saltsuffix;
27 }
28 ?>