Mercurial > projects > dcrypt
comparison dcrypt/crypto/macs/HMAC.d @ 33:b9f8aa42a547
More changes suggested by Glenn Haecker for D2 compatibility.
author | Thomas Dixon <reikon@reikon.us> |
---|---|
date | Thu, 14 May 2009 01:33:11 -0400 |
parents | 21847420b1ac |
children |
comparison
equal
deleted
inserted
replaced
32:2b4bccdc8387 | 33:b9f8aa42a547 |
---|---|
41 ipad = new ubyte[blockSize]; | 41 ipad = new ubyte[blockSize]; |
42 opad = new ubyte[blockSize]; | 42 opad = new ubyte[blockSize]; |
43 | 43 |
44 if (key) | 44 if (key) |
45 init(new SymmetricKey(key)); // I'm lazy. | 45 init(new SymmetricKey(key)); // I'm lazy. |
46 } | |
47 | |
48 /** Play nice with D2's idea of const. */ | |
49 version (D_Version2) | |
50 { | |
51 this (Hash hash, string key) | |
52 { | |
53 this(hash, cast(ubyte[])key); | |
54 } | |
46 } | 55 } |
47 | 56 |
48 void init(CipherParameters params) | 57 void init(CipherParameters params) |
49 { | 58 { |
50 SymmetricKey keyParams = cast(SymmetricKey)params; | 59 SymmetricKey keyParams = cast(SymmetricKey)params; |
114 reset(); | 123 reset(); |
115 | 124 |
116 return r; | 125 return r; |
117 } | 126 } |
118 | 127 |
119 char[] hexDigest() | 128 string hexDigest() |
120 { | 129 { |
121 return ByteConverter.hexEncode(digest()); | 130 return ByteConverter.hexEncode(digest()); |
122 } | 131 } |
123 | 132 |
124 HMAC copy() | 133 HMAC copy() |