SHARE
TWEET

Untitled

a guest Sep 19th, 2019 85 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top