I am updating an authorize.net integration with OpenACS and I need to create a hash using SHA512. It looks like the latest Naviserver has ns_hmac which will do exactly what I need.
The trick is, I need to take the key as represented by a hex string and covert that to a byte array to pass the byte array as the key to the hmac function.
Tcl doesn't really seem to have high-level access to byte arrays to pass to a procedure. Any ideas?
I tried something like this but it generates an invalid hash according to authorize.net
set b [binary format H* "abcd1234"]
set h [ns_hmac string -digest SHA512 $b "This is a test"]
It definitely gives a different result than a Python implementation using a byte array type.