digitalmars.D.learn - HMAC and toHexString
- Nicholas Wilson (17/17) Jul 17 2018 ...
- Alex (21/38) Jul 18 2018 Don't know, what you mean. Works for me:
- Nicholas Wilson (2/19) Jul 18 2018 Ahh, the joys of memory corruption.
- baz dlang-community (3/7) Jul 18 2018 You've reached https://issues.dlang.org/show_bug.cgi?id=16519
- Nicholas Wilson (4/13) Jul 18 2018 Not sure if it was that or some of the other memory corruption I
- Seb (3/7) Jul 18 2018 Yep, actually this one is a very common one.
... 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?
Jul 17 2018
On Wednesday, 18 July 2018 at 05:54:48 UTC, Nicholas Wilson wrote:... 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?Don't know, what you mean. Works for me: ´´´ import std.stdio; import std.digest.hmac; import std.digest.sha; import std.string; import std.meta; void main() { 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] r = mac.finish; r.toHexString!(LetterCase.lower).writeln; } ´´´ output: dc84632fc9b5d1f4b879d9aa021ae0d089e7f66a2fd2e824829cfceedbece729
Jul 18 2018
On Wednesday, 18 July 2018 at 05:54:48 UTC, Nicholas Wilson wrote:... 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?Ahh, the joys of memory corruption.
Jul 18 2018
On Wednesday, 18 July 2018 at 11:22:36 UTC, Nicholas Wilson wrote:On Wednesday, 18 July 2018 at 05:54:48 UTC, Nicholas Wilson wrote:You've reached https://issues.dlang.org/show_bug.cgi?id=16519 maybe ?[...]Ahh, the joys of memory corruption.
Jul 18 2018
On Wednesday, 18 July 2018 at 11:29:42 UTC, baz dlang-community wrote:On Wednesday, 18 July 2018 at 11:22:36 UTC, Nicholas Wilson wrote:Not sure if it was that or some of the other memory corruption I was experiencing.On Wednesday, 18 July 2018 at 05:54:48 UTC, Nicholas Wilson wrote:You've reached https://issues.dlang.org/show_bug.cgi?id=16519 maybe ?[...]Ahh, the joys of memory corruption.
Jul 18 2018
On Wednesday, 18 July 2018 at 11:22:36 UTC, Nicholas Wilson wrote:On Wednesday, 18 July 2018 at 05:54:48 UTC, Nicholas Wilson wrote:Yep, actually this one is a very common one. However, -dip1000 would warn you here ...[...]Ahh, the joys of memory corruption.
Jul 18 2018