Mercurial > projects > dcrypt
diff dcrypt/crypto/hashes/SHA256.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/SHA256.d Tue Aug 12 05:48:06 2008 -0400 +++ b/dcrypt/crypto/hashes/SHA256.d Wed Aug 13 22:01:19 2008 -0400 @@ -143,6 +143,19 @@ h7 = 0x5be0cd19u; } + SHA256 copy() { + SHA256 h = new SHA256(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 = [ @@ -169,7 +182,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]~")"); } } }