aboutsummaryrefslogtreecommitdiff
path: root/rng.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'rng.cpp')
-rw-r--r--rng.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/rng.cpp b/rng.cpp
index e06b8be..fc86993 100644
--- a/rng.cpp
+++ b/rng.cpp
@@ -23,7 +23,7 @@ inline uint64_t rotr64(uint64_t x,uint32_t n){
KeyRng::KeyRng(const char *key_,int keylen_)
:keylen(keylen_),idx(0),state(0){
- assert(keylen>0);
+ if(keylen<=0)throw invalid_argument("KeyRng: Key should not be empty");
assert(key_);
key=new uint8_t[keylen];
memcpy(key,key_,keylen);
@@ -32,7 +32,7 @@ KeyRng::KeyRng(const char *key_,int keylen_)
KeyRng::KeyRng(const string &key_)
:keylen(key_.size()),idx(0),state(0){
- assert(keylen>0);
+ if(keylen==0)throw invalid_argument("KeyRng: Key should not be empty");
key=new uint8_t[keylen];
memcpy(key,key_.data(),keylen);
stir();