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

Reply via email to