HMAC and toHexString
Nicholas Wilson
iamthewilsonator at hotmail.com
Wed Jul 18 05:54:48 UTC 2018
...
string key = "blahblahblah";
auto mac = hmac!SHA256(key.representation);
string s = ...,t=...u=...,v=...;
foreach(w;AliasSeq!(s,t,u,v))
mac.put(w.representation);
ubyte[32] s = mac.finish;
string sig = toHexString!(LetterCase.lower)(s);
writeln(sig);
// From what I understand Should print something like
41771e2d0d6c1cf7f442aa8547783ea5b126bfc15a4b354e94d0eaea2ab0fa1a
// Actually prints something like x"31 36 39 33 39 32 38 31 62 38
31 62 36 36 62 63 63 34 63 36 36 61 62 32 34 37 64 32 64 34 61 00
78 2A 55 5B FF 7F 00 00 78 2A 55 5B FF 7F 00 00 E0 2A 55 5B FF 7F
00 00 08 2C 55 5B FF 7F 00 00"c
Note the nuls and things like FF
What am I doing wrong here?
More information about the Digitalmars-d-learn
mailing list