public static function saltedHash($data, $scheme, $hash_type = 'md5') { $salt = owa_coreAPI::getSalt($scheme); return owa_lib::hash($hash_type, $data, $salt); }
function generateAuthCredential($user_id, $password, $expiration = '', $scheme = 'auth') { $frag = substr($password, 8, 4); $key = owa_coreAPI::saltedHash($user_id . $frag . $expiration, $scheme); $algo = 'sha1'; if (function_exists('hash')) { $algo = 'sha256'; } $hash = owa_lib::hash($algo, $user_id . $expiration, $key); $credential = $hash; // could add other elements here. return $credential; }