I have been working on an app that uses a combination of different encryption methods; some of them are libraries, and the most important ones are my own implementations. The app is cross-platform that are compiled natively on desktop (Linux, Windows, MacOS); on mobile, I used WebAssembly for android, obj-c calls to a c wrapper to swift on iOS ; the last, on web/browsers I used a WebAssembly module.
The problem is I have searched of ways the c++ "std::random_device" object can be spoofed, and return deterministic output(my code in the snippet below). Since I want to use a single code-base for all platforms for encryption, are there ways to achieve a near truly random (not easily spoofed) number generator?
I needed to change the current implementation because I have seen it spit out exact same outputs before in the browser version.
Any suggestions are appropriated. Thank you!
namespace std{
...
for (unsigned int i=0; i<n; i++ ){
random_device rand;
mt19937 gen(rand());
output[I] = gen();
}
...
}