4 #include <openssl/evp.h>
6 void hextorb(uint8_t* hex
, uint8_t* rb
)
8 while(sscanf(hex
, "%2x", rb
) == 1)
16 int main(int argc
, char** argv
)
22 uint32_t key_length
= atoi(argv
[1]);
23 uint32_t iteration_count
= atoi(argv
[2]);
25 hextorb(argv
[3], salt
);
26 uint32_t salt_length
= strlen(argv
[3]) / 2;
28 fgets(k_user
, 2048, stdin
);
29 uint32_t k_user_length
= strlen(k_user
);
30 if(k_user
[k_user_length
- 1] == '\n') {
31 k_user
[k_user_length
- 1] = '\0';
34 PKCS5_PBKDF2_HMAC(k_user
, k_user_length
, salt
, salt_length
, iteration_count
, EVP_sha512(), key_length
, key
);
35 fwrite(key
, 1, key_length
, stdout
);