algo = strtolower($a); continue; } } // Throw a exception if no matching algorithm can be found if (empty($this->algo)) { throw new OAuthException(t('None of the suggested hash algorithms (@cand) were ' . 'supported by the server. Try one of the following: !algos.', array( '@cand' => join($algo, ', '), '!algos' => join($algos, ', '), ))); } } public function get_name() { return "HMAC-" . strtoupper($this->algo); } public function build_signature($request, $consumer, $token) { $base_string = $request->get_signature_base_string(); $request->base_string = $base_string; $key_parts = array( $consumer->secret, ($token) ? $token->secret : "" ); $key_parts = OAuthUtil::urlencode_rfc3986($key_parts); $key = implode('&', $key_parts); return base64_encode(hash_hmac($this->algo, $base_string, $key, TRUE)); } }