diff options
author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2017-06-05 12:15:28 -0700 |
---|---|---|
committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2017-06-05 12:15:28 -0700 |
commit | 9b287392a4af95ee0d15db7e3d1f9dd6bd804060 (patch) | |
tree | c7bf3bb3c37e6c5ff4545e0249d3e089ae2d96fc /node/Buffer.hpp | |
parent | aa06470cb6e779563e6c21e1166c36e30a2138ce (diff) | |
download | infinitytier-9b287392a4af95ee0d15db7e3d1f9dd6bd804060.tar.gz infinitytier-9b287392a4af95ee0d15db7e3d1f9dd6bd804060.zip |
.
Diffstat (limited to 'node/Buffer.hpp')
-rw-r--r-- | node/Buffer.hpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/node/Buffer.hpp b/node/Buffer.hpp index fea32767..69ee1758 100644 --- a/node/Buffer.hpp +++ b/node/Buffer.hpp @@ -263,6 +263,19 @@ public: } /** + * 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 * * @param b Data |