From fe2ad315db366fc408153911b4fe5412076495bc Mon Sep 17 00:00:00 2001 From: Michele Zonca Date: Sun, 11 Sep 2011 16:52:03 +0200 Subject: [PATCH] version 0.4 --- main/mashape/http/AuthUtil.php | 38 ++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 main/mashape/http/AuthUtil.php diff --git a/main/mashape/http/AuthUtil.php b/main/mashape/http/AuthUtil.php new file mode 100644 index 0000000..646ab37 --- /dev/null +++ b/main/mashape/http/AuthUtil.php @@ -0,0 +1,38 @@ +. + * + * + * The author of this software is Mashape, Inc. + * For any question or feedback please contact us at: support@mashape.com + * + */ + +class AuthUtil { + + public static function generateAuthenticationHeader($publicKey, $privateKey) { + $uuid = uniqid(); + $hash = hash_hmac("sha1", $uuid, $privateKey); + $header = "X-Mashape-Authorization: " . base64_encode($publicKey . ":" . $hash . $uuid) . "\r\n"; + return $header; + } + +} + +?>