In C++ we can generate true random numbers (if your hardware supports) with random_device. And i am writing a implementation of One-time Pad algorithm with C. Is there a way to generate true random numbers in C? I writing with C for speed and some another reasons. If i use a PRNG, it is will be unsafe.
char *KeyGenerate(unsigned long long StringLength)
{
std::random_device TrueRandomNumberGenerator;
char *Key = (char *) malloc(StringLength + 1);
for(unsigned long long I = 0; I < StringLength; I++)
{
Key[I] = TrueRandomNumberGenerator();
}
Key[StringLength] = '\0';
return Key;
}