=")) { function binsha1($d) { return sha1($d, true); } } else { function binsha1($d) { return pack('H*', sha1($d)); } } } global $aws_secret; if (strlen($aws_secret) == 40) $aws_secret = $aws_secret.str_repeat(chr(0), 24); $ipad = str_repeat(chr(0x36), 64); $opad = str_repeat(chr(0x5c), 64); $hmac = binsha1(($aws_secret^$opad).binsha1(($aws_secret^$ipad).$stringToSign)); return base64_encode($hmac); } // hmac-sha1 code END ?>