Problem with digest Hmac sha256 method and another problem while using openssl hmac
Ali Çehreli
acehreli at yahoo.com
Fri Dec 8 21:34:52 UTC 2017
On 12/08/2017 01:05 PM, kerdemdemir wrote:
> Hi,
>
> I need to have the same result while using :
>
> openssl
Works for me as adapted from Phobos documentation:
import std.stdio;
import std.digest.hmac, std.digest.sha;
import std.string : representation;
void main() {
auto hmac = HMAC!SHA256("key".representation);
hmac.put("value".representation);
foreach (m; hmac.finish()) {
writef("%02x", m);
}
writeln();
}
Assuming the program is called 'deneme', the result is the same:
$ echo -n "value" | openssl dgst -sha256 -hmac "key" && ./deneme
(stdin)= 90fbfcf15e74a36b89dbdb2a721d9aecffdfdddc5c83e27f7592594f71932481
90fbfcf15e74a36b89dbdb2a721d9aecffdfdddc5c83e27f7592594f71932481
Ali
More information about the Digitalmars-d-learn
mailing list