安装好vs2019版本,下载http://www.openssl.vip/download
要对openssl源码进行编译我们应该安装nasm(配置它的环境变量),perl。
如下代码:
windows下第一个随机数生成项目
#include <stdio.h>
#include <openssl/rand.h>
#include <iostream>
#include <time.h>
using namespace std;
int main()
{
cout << "first openssl code!" << endl;
time_t t = time(0); //以时间作为随机数种子
unsigned char buf[16] = { 0 };
int re = RAND_bytes(buf, sizeof(buf));
for (int i = 0; i < sizeof(buf); i++)
{
cout << "[" <<(int) buf[i] << "]";
}
getchar();
return 0;
}