我采用Md5的加密方式:
如下:
#include <openssl/md5.h>
int encryptMd5(char* password, const char* pass)
{
int i = 0;
MD5_CTX x;
unsigned char out[36];
memset (out, 0, sizeof(out));
MD5_Init(&x);
MD5_Update(&x, pass, strlen(pass));
MD5_Final(out, &x);
for (i = 0; i<strlen(out); i++)
{
sprintf(password+i*2, "%02x", out[i]);
}
return 0;
}