Tuesday, December 18, 2012
an openssl sha512 example
/*--------cpp code-------------*/
#include <openssl/sha.h>
#include <stdio.h>
int main(){
unsigned char *md = new unsigned char[64];
SHA512((unsigned char*)"a", 1, md);
for(int i=0; i<64; ++i){
printf("%02x", md[i]);
}
printf("\n");
}
compile using:
>g++ -I /usr/local/ssl/include -L /usr/local/ssl/lib -l crypto sha512test.c
>./a.out
1f40fc92da241694750979ee6cf582f2d5d7d28e18335de05abc54d0560e0f5302860c652bf08d560252aa5e74210546f369fbbbce8c12cfc7957b2652fe9a75
Labels:
opensll sha
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment