md5加密 实例

来源:互联网 发布:大数据在医疗的应用 编辑:程序博客网 时间:2024/06/01 08:51

#include <openssl/md5.h>#include <stdio.h>#include <time.h> int getEncPwd(char* out)  {         char *hex;     char seed[60];     time_t now;     struct tm* TM;     unsigned long lTmp;     time(&now);     TM = localtime(&now);     sprintf(seed,"%02d%02d%02d%02d%02d",TM->tm_year-100,TM->tm_mon+1,TM->tm_mday,TM->tm_hour,TM->tm_min/30);     lTmp = strtol(seed,NULL,0);     sprintf(seed,"%08x",lTmp);     //printf("seed=%s\n",seed);     hex = crypt(seed,"0x");     //printf("hex=%s\n",hex+2);     strcpy(out,hex+2);  return 0;   }

0 0
原创粉丝点击