# Generate a Salt $fullname = "Users Name"; $now = time; ($pert1, $pert2) = unpack("C2", "$fullname"); $week = $now / (60*60*24*7) + $pert1 + $pert2; $salt = ($week % 64) + ($now % 64); $salt = sprintf("%lx", $salt); # Use crypt to encrypt our password $passwd = crypt($password, $salt);