This commit is contained in:
Adam Ierymenko 2017-06-05 12:15:28 -07:00
parent aa06470cb6
commit 9b287392a4
7 changed files with 636 additions and 294 deletions

View file

@ -262,6 +262,19 @@ public:
_b[_l++] = (char)c;
}
/**
* Append secure random bytes
*
* @param n Number of random bytes to append
*/
inline void appendRandom(unsigned int n)
{
if (unlikely((_l + n) > C))
throw std::out_of_range("Buffer: append beyond capacity");
Utils::getSecureRandom(_b + _l,n);
_l += n;
}
/**
* Append a C-array of bytes
*