Forum Discussion
cblown
7 years agoBoss
Actually, you know what I don't think the key is all that sensitive on its own, its a testing key anyway and you need an app Id and other stuff.. So here it is again with the real key :)
PHP
echo base64_encode(hash_hmac('sha256', "the quick brown fox jumps over the lazy dog", base64_decode("2ZKF2RDckw3M++TwLVP8t+AQIU66Rj3mCykTbMwBnOWUpAnM") , true));
Result
2IweFAZF3mu13aizUcTjRV450W1LEwISUJnRnOapOUk=
Freemarker
<#assign signature = utils.digest.hmac("HmacSHA256", utils.base64.decode("2ZKF2RDckw3M++TwLVP8t+AQIU66Rj3mCykTbMwBnOWUpAnM"), "the quick brown fox jumps over the lazy dog") /> ${signature}
Result
w868e7nxYVl+qNTNMg6Zb4rLOh02x0jC5i8LYfkeVuE=
cblown
7 years agoBoss
Today we've tried various charsets since the HMAC routines accept charset parameters for the string if the input isn't UTF-8. No luck so far. I'm really not sure what specifically is the problem, but as you can see from my last post we're are getting different results with that key. Unfortunately the unencoded version of that key is a bunch of garble and not nice ascii like our example.
The raw unencoded hex is
0000000 d9 92 85 d9 10 dc 93 0d cc fb e4 f0 2d 53 fc b7 0000010 e0 10 21 4e ba 46 3d e6 0b 29 13 6c cc 01 9c e5 0000020 94 a4 09 cc 0000024
Any ideas how I can get this back into Freemarker as a UTF-8 string? And don't say base 64 encode it :)
Related Content
- 4 years ago
- 13 years agoInactive User
- 6 years ago