Created
July 7, 2014 08:05
-
-
Save blessdyb/8848f1a7799ff4559e5c to your computer and use it in GitHub Desktop.
Several php authentication security method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function md5_auth() { | |
$current_time = time(); | |
$hash_str = join("", array(MD5_SALT_KEY, $current_time)); | |
return array( | |
'current_time' => $current_time, | |
'token' => base64_encode(md5($hash_str)), | |
); | |
} | |
function swt_auth($parameters) { | |
// Build an HMAC-SHA1 signature using the multipass string and your API key | |
$signature = hash_hmac("sha1", $parameters, HAMC_KEY, true); | |
// Base64 encode the signature | |
$signature = base64_encode($signature); | |
return $signature; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment