HMAC SHA1 in Coldfusion?

Hello there,

I'm wondering if there is a simple way to implement HMAC SHA1 in coldfusion.

The PHP version looks like this:

//Calculate HMAC-SHA1 according to RFC2104
function hmacsha1($key,$data) {
   if (strlen($key)>$blocksize)
       $key=pack('H*', $hashfunc($key));
   $hmac = pack(
   return bin2hex($hmac);

I think most of it is fairly straightforward, however I don't know if there is a good way to work with hex data in coldfusion. Any help would be appreciated.

Who is Participating?
Depends on the CF Version, In version 7, the HASH Function supports SHA1.  There is also a custom tag for prior version. I'll look it up and get back in a minute.
umbraeAuthor Commented:
HMAC sha1 isn't just sha1:
umbraeAuthor Commented:
Ah! it appears theres a CF_HMAC tag. Thats exactly what I was looking for.

I understand now. The SHA-1 part is only a piece. The EE link that I showed though was trying to do the HMAC SHA-1 though I believe.
I think this link is the macromedia custom tag to do the HMAC.

The EE link showed how to implement it.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.