#pragma once #include class RandomNumberGenerator { private: //主方案:OpenSSL,安全随机数,有极小概率失败 static bool FillWithOpenSSLRandom(unsigned char* dst, size_t len) noexcept; //备用方案:std::mt19937_64/时间戳伪随机数,不怎么安全但是一定有数 static bool FillWithSTDMT19937_64(unsigned char* dst, size_t len) noexcept; static std::string Bytes2HexString(const unsigned char* data, size_t len) noexcept; public: static std::string SecureRandomHex(size_t bytes); };