Mercurial > projects > dcrypt
diff dcrypt/crypto/Hash.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 | cff9960a019c |
line wrap: on
line diff
--- a/dcrypt/crypto/Hash.d Tue Aug 12 05:48:06 2008 -0400 +++ b/dcrypt/crypto/Hash.d Wed Aug 13 22:01:19 2008 -0400 @@ -17,17 +17,20 @@ MODE_SHA, MODE_TIGER } - private ubyte[] buffer; - uint bytes, - index; - + + protected { + ubyte[] buffer; + uint bytes, + index; + } + this (void[] input_=null) { buffer = new ubyte[blockSize]; ubyte[] input = cast(ubyte[]) input_; if (input) update(input); } - + /** Returns: The block size of the hash function in bytes. */ abstract uint blockSize(); @@ -36,7 +39,10 @@ /** Returns: The name of the algorithm we're implementing. */ abstract char[] name(); - + + /** Returns: A copy of this hash object. */ + abstract Hash copy(); + /** * Introduce data into the hash function. *