openssl(sha)

#include "stdafx.h"
#include <string.h>
#include <openssl/sha.h>
int main(int argc, char* argv[])
{
 printf("Hello World!\n");
 char buf[]="123456";
 unsigned char md[50]={0};
 SHA_CTX ctx;
 SHA_Init(&ctx);
 SHA_Update(&ctx,buf,strlen(buf));
// SHA_Update(&ctx,buf,strlen(buf));
 int rs= SHA_Final(md,&ctx);
 for (int i=0;i<20;i++)
 {
  printf("%.2X ",md[i]);
 }
 return 0;
}
posted @ 2008-08-20 10:00  ahuo  阅读(707)  评论(0编辑  收藏  举报