public function hash($pwd, $salt = null) { if ($salt === null) { return md5($pwd); } else { return md5(md5($pwd) . $salt); } }