Mercurial > projects > dcrypt
diff dcrypt/crypto/prngs/PRNGFromHash.d @ 16:703901987976
Removed default of SHA256 for PRNGFromHash.
author | Thomas Dixon <reikon@reikon.us> |
---|---|
date | Wed, 19 Nov 2008 19:44:44 -0500 |
parents | 5ce3012f1def |
children | 8b5eaf3c2979 |
line wrap: on
line diff
--- a/dcrypt/crypto/prngs/PRNGFromHash.d Wed Nov 19 19:30:52 2008 -0500 +++ b/dcrypt/crypto/prngs/PRNGFromHash.d Wed Nov 19 19:44:44 2008 -0500 @@ -10,7 +10,6 @@ import dcrypt.crypto.PRNG; import dcrypt.crypto.Hash; -import dcrypt.crypto.hashes.SHA256; /** Creates a PRNG from a hash function. */ class PRNGFromHash : PRNG { @@ -31,8 +30,11 @@ return hash.name~"PRNG"; } - this(Hash hash=null) { - this.hash = (hash is null) ? new SHA256() : hash; + this(Hash hash) { + if (hash is null) + throw new InvalidParameterError( + name()~": Invalid parameter passed to constructor."); + this.hash = hash; this.hash.reset(); counter = new ubyte[COUNTER_SIZE]; @@ -71,4 +73,4 @@ } return output.length; } -} +} \ No newline at end of file