-
November 8, 2007
How to calculate a Base64 encoded HMAC-SHA1 in PHP for OAuth.HMAC-SHA1 is the suggested default signing algorithm for OAuth 1.0 Core. This is a code snippet showing how to calculate a valid OAuth HMAC-SHA1 signature using PHP4 without any PEAR dependencies.
4.
(Aside Code, hashing, hmac-sha1, oauth, php, security)




Please also read the following article: http://blog.rednael.com/2008/09/30/SecuringYourPasswordTransfersWithKeyedHashingHMACCramMD5.aspx
It’s a walkthrough example of implementing HMAC-MD5 / Cram-MD5 on a website. The same technique can be used for various client-server situations. The article explains the benefits of using such a password system and shows you how to implement it using the .Net library at server side (examples in C#), and using Paj’s MD5 Javascript functions at client-side.
Thanks for posting the hmacsha1() function! Very useful!
or this native function from php http://us2.php.net/manual/en/function.hash-hmac.php
Thank you!