Neeao’s Blog ( http://neeao.com/ ) :
找个能使用的c++调用openssl的代码都这么难,自己写了个,记录下。
以下代码在CentOS5下测试可用。
//============================================================================
// Name : m d 5.cpp
// Author : Neeao
// Version :
// Copyright : http://Neeao.com
//============================================================================
#include <iostream>
#include <openssl/md5.h>
#include <fstream>
using namespace std;
/**
* 字符串md5
*/
string string_md5(string str)
{
unsigned char md[16];
char tmp[33]={'