$key = "12345678876543211234567887654321";
$iv = "1234567887654321";
$plaindata = "This is a test string";
$enc = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $plaindata, MCRYPT_MODE_CBC, $iv));
$str = hash_hmac("sha256", utf8_encode($iv . '.' . $enc), utf8_encode($key));
echo($str);
This gives me e63d4ab83f90cfec1acdaf831091b6394167ae728b657e44afad1e7553843eeb
How can I get the same result in ColdFusion9 Development Edition?
I found a solution on this page http://www.isummation.com/blog/calculate-hmac-sha256-digest-using-user-defined-function-in-coldfusion/
Your need to call the function like this
<cfoutput>#LCase(HMAC_SHA256(iv & "." & Encrypted_Data, key))#</cfoutput>
Worked like a charm.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With