Mercurial > projects > dcrypt
diff dcrypt/crypto/hashes/SHA224.d @ 2:71aae178f89a
Added copy() to hash functions. Modified some code style.
author | Thomas Dixon <reikon@reikon.us> |
---|---|
date | Wed, 13 Aug 2008 22:01:19 -0400 |
parents | 0e08791a1418 |
children | a5789a7b3b3b |
line wrap: on
line diff
--- a/dcrypt/crypto/hashes/SHA224.d Tue Aug 12 05:48:06 2008 -0400 +++ b/dcrypt/crypto/hashes/SHA224.d Wed Aug 13 22:01:19 2008 -0400 @@ -37,7 +37,7 @@ Util.uintToUbytesBig(h4, result, 16); Util.uintToUbytesBig(h5, result, 20); Util.uintToUbytesBig(h6, result, 24); - + reset(); return result; } @@ -54,6 +54,19 @@ h7 = 0xbefa4fa4u; } + SHA224 copy() { + SHA224 h = new SHA224(buffer[0..index]); + h.h0 = h0; + h.h1 = h1; + h.h2 = h2; + h.h3 = h3; + h.h4 = h4; + h.h5 = h5; + h.h6 = h6; + h.h7 = h7; + return h; + } + version (UnitTest) { unittest { static const char[][] test_inputs = [ @@ -80,7 +93,7 @@ h.update(input); char[] digest = h.hexDigest(); assert(digest == test_results[i], - h.name()~": ("~digest~") != ("~test_results[i]~")"); + h.name~": ("~digest~") != ("~test_results[i]~")"); } } }