Mercurial > projects > dcrypt
diff dcrypt/crypto/macs/HMAC.d @ 14:5ce3012f1def
Removed some redundancy in code. Added NotSupportedError, a base PRNG class and a class which creates a PRNG from a hash function. Changed the MAC class' finalization methods to digest and hexDigest instead of finish and hexFinish respectively. Also added a base Checksum class, crc32 and adler32 in dcrypt.misc as per request.
author | Thomas Dixon <reikon@reikon.us> |
---|---|
date | Tue, 18 Nov 2008 18:03:40 -0500 |
parents | 5cb17e09d685 |
children | 0de48552be35 |
line wrap: on
line diff
--- a/dcrypt/crypto/macs/HMAC.d Fri Sep 12 05:20:43 2008 -0400 +++ b/dcrypt/crypto/macs/HMAC.d Tue Nov 18 18:03:40 2008 -0500 @@ -95,14 +95,14 @@ return inner.digestSize; } - ubyte[] finish() { + ubyte[] digest() { outer.update(inner.digest()); ubyte[] r = outer.digest(); reset(); return r; } - char[] hexFinish() { + char[] hexDigest() { return Util.ubytesToHex(finish()); } @@ -151,7 +151,7 @@ h.init(new SymmetricKey(Util.hexToUbytes(k))); for (int j = 0; j < test_repeat[i]; j++) h.update(Util.hexToUbytes(test_inputs[i])); - char[] mac = h.hexFinish(); + char[] mac = h.hexDigest(); assert(mac == test_results[i], h.name~": ("~mac~") != ("~test_results[i]~")"); }