X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=version2%2Fsrc%2FC%2FSecureRandom.cpp;fp=version2%2Fsrc%2FC%2FSecureRandom.cpp;h=84f40c3b197647e1393a94f7d629978e4a16d0c9;hb=786e40250f31eff04eec25bbcaae3cd916fedb14;hp=0000000000000000000000000000000000000000;hpb=3f24bffc82ebfe2730308b63100af08645316577;p=iotcloud.git diff --git a/version2/src/C/SecureRandom.cpp b/version2/src/C/SecureRandom.cpp new file mode 100644 index 0000000..84f40c3 --- /dev/null +++ b/version2/src/C/SecureRandom.cpp @@ -0,0 +1,14 @@ +#include "SecureRandom.h" +#include +#include + +SecureRandom::SecureRandom() { +} + +void SecureRandom::nextBytes(Array *array) { + arc4random_buf(array->internalArray(), array->length()); +} + +int32_t SecureRandom::nextInt(int32_t val) { + return arc4random_uniform(val); +}