Advertisement
Guest User

Untitled

a guest
Sep 19th, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. #include <iomanip>
  2. #include <iostream>
  3. #include <openssl/evp.h>
  4. #include <openssl/sha.h>
  5. #include <sstream>
  6. #include <string.h>
  7. #include <stdlib.h>
  8.  
  9. int main() {
  10. unsigned char *out;
  11. char pwd[] = "QwE";
  12. unsigned char salt[] = {'S','a','l','t','e','t',' ','t','i','l',' ','O','l','a'};
  13. int iterations = 2048;
  14. int keyLength = 20;
  15.  
  16. out = (unsigned char *) malloc(sizeof(unsigned char) * keyLength);
  17.  
  18. PKCS5_PBKDF2_HMAC_SHA1(pwd, strlen(pwd), salt, sizeof(salt), iterations, keyLength, out);
  19.  
  20. printf("out: "); for(int i=0;i<keyLength;i++) { printf("%02x", out[i]); } printf("\n");
  21.  
  22. free(out);
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement