diff options
Diffstat (limited to 'rng.cpp')
-rw-r--r-- | rng.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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(); |