diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2021-02-10 13:31:11 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2021-02-10 13:31:11 +0700 |
commit | 44528a599c73bf638088ce040253b5fe6878d20b (patch) | |
tree | d01c88e4c24b653f83693536c7808f3cf8559d3f | |
parent | Add TestRandomData class (diff) | |
download | BouncyCastle.NET-ed25519-44528a599c73bf638088ce040253b5fe6878d20b.tar.xz |
Tolerate null/empty seed
-rw-r--r-- | crypto/src/crypto/prng/DigestRandomGenerator.cs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/crypto/src/crypto/prng/DigestRandomGenerator.cs b/crypto/src/crypto/prng/DigestRandomGenerator.cs index f5a29952a..024db2852 100644 --- a/crypto/src/crypto/prng/DigestRandomGenerator.cs +++ b/crypto/src/crypto/prng/DigestRandomGenerator.cs @@ -1,7 +1,7 @@ using System; -using Org.BouncyCastle.Crypto.Digests; using Org.BouncyCastle.Crypto.Utilities; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Crypto.Prng { @@ -40,8 +40,11 @@ namespace Org.BouncyCastle.Crypto.Prng { lock (this) { - DigestUpdate(inSeed); - DigestUpdate(seed); + if (!Arrays.IsNullOrEmpty(inSeed)) + { + DigestUpdate(inSeed); + } + DigestUpdate(seed); DigestDoFinal(seed); } } |