Hello,
I have an issue with calculating the HMAC Hash on a virtual machine. It gives me a different result then OpenSSL, which is not the case on my personal computer:
# swipl -version
Welcome to SWI-Prolog (threaded, 64 bits, version 8.0.3)
...
root@h2181216:# swipl -g go swi_test-hmac.pl
9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
root@h2181216:# echo -n test | openssl dgst -sha256 -hmac "test"
(stdin)= 88cd2108b5347d973cf39cdf9053d7dd42704876d8c9a9bd8e2d168259d3ddf7
root@h2181216:# cat swi_test-hmac.pl
:- use_module(library(ssl)).
go:-
crypto_data_hash(test,Sigelo,[algorithm(sha256),hmac(test)]),
writeln(Sigelo).
root@h2181216:# uname -a
Linux h2181216.stratoserver.net 4.4.0-042stab141.3 #1 SMP Fri Nov 15 22:45:34 MSK 2019 x86_64 x86_64 x86_64 GNU/Linux
On my PC I get the correct value:
wolfram@kardo:$ swipl -g go bin/swi_test-hmac.pl
88cd2108b5347d973cf39cdf9053d7dd42704876d8c9a9bd8e2d168259d3ddf7
wolfram@kardo:$ uname -a
Linux kardo 4.15.0-96-generic #97-Ubuntu SMP Wed Apr 1 03:25:46 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
What may be wrong?