Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iomanip>
- #include <iostream>
- #include <openssl/evp.h>
- #include <openssl/sha.h>
- #include <sstream>
- #include <string.h>
- #include <stdlib.h>
- int main() {
- unsigned char *out;
- char pwd[] = "QwE";
- unsigned char salt[] = {'S','a','l','t','e','t',' ','t','i','l',' ','O','l','a'};
- int iterations = 2048;
- int keyLength = 20;
- out = (unsigned char *) malloc(sizeof(unsigned char) * keyLength);
- PKCS5_PBKDF2_HMAC_SHA1(pwd, strlen(pwd), salt, sizeof(salt), iterations, keyLength, out);
- printf("out: "); for(int i=0;i<keyLength;i++) { printf("%02x", out[i]); } printf("\n");
- free(out);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement