// Test.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <windows.h>
#include <openssl/evp.h>
#include <openssl/hmac.h>
#ifdef _WIN64
// openssl静态库, 版本:0.98j
#ifdef _DEBUG
#pragma comment(lib, "../lib/x64/Debug/libeay32.lib")
#else
#pragma comment(lib, "../lib/x64/Release/libeay32.lib")
#endif
#else
// openssl静态库, 版本:0.97f
#ifdef _DEBUG
#pragma comment(lib, "../lib/win32/Debug/ESAEay32.lib")
#else
#pragma comment(lib, "../lib/win32/Release/ESAEay32.lib")
#endif
#endif
int main(int argc, char* argv[])
{
const EVP_MD *pEvpMd = NULL;
pEvpMd = EVP_md2();
//pEvpMd = EVP_md5();
//pEvpMd = EVP_sha1();
HMAC_CTX *pSignMacCtx = new HMAC_CTX;
HMAC_CTX_init( pSignMacCtx );
HMAC_Init( pSignMacCtx, "12345678", 8, pEvpMd );
HMAC_Update( pSignMacCtx, (PBYTE)"12345678", 8 );
BYTE pbMac[100] = {'\0'};
unsigned int uiMac = sizeof(pbMac);
HMAC_Final( pSignMacCtx, pbMac, &uiMac );
HMAC_CTX_cleanup( pSignMacCtx );
delete pSignMacCtx;
return 0;
}