Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <openssl/rand.h>
- int main(int argc, char **argv) {
- FILE *fptr;
- fptr = fopen("key.txt", "w");
- unsigned char key[16];
- if (fptr == NULL) {
- printf("Error opening file");
- return EXIT_FAILURE;
- }
- if (!RAND_bytes(key, sizeof key)) {
- return EXIT_FAILURE;
- }
- fprintf(fptr, "%s", key);
- fclose(fptr);
- // printf("%s", key)
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement