Currently i have a program which use openssl libraries to generate random number using the API
unsigned char salt;
Below are my printf's
printf("%c", salt); -> I see some special characters getting printed (not human readbale)
pirntf("%x":, salt) -> i see correct value
sampl eo/p of RAND_bytes(): fc8d1ffbde2b3f10e21f9e57b87d86079e9f04f2810cb66269 3fbaffeaa6
Need help to understand this....
Now i store the salt() to a file as below
fprintf(saltfile, "%02x", salt_value[i]); [ assume file operations to be performed before executing this statement is done].
When i see the contents of file, they are correct as expected.
Now i do a fgets() to read 32 bytes on the above file, it reds 32 characters which is not the full random vale i got above coz fgets() or fgetc() treats each encountered character as one char read.
Now to store the above salt value, i would need a 64 byte of array but i want to have 32 bytes array like i have salt and replicate the contents of the array same as that of salt() array when reading from a file...
Pleas help me to understand this... thanks