Hello,
I have this project where I have to give the user the option to apply MD4, MD5,or SHA1 in C++. Once the user selects one of the three specified hash functions, the program will apply the selected hash function to an arbitrary length local file named "input.txt". We were told that the functions are already implmented in Linux,at this time I would like to know how do you call such function in C++.Any help/advice would be greatly appreciated.
Duoas,
Thanks, that was helpful. However, I have another question. How would you apply the functon to a file. For example, say the user selects MD5, How would I apply MD5 to input.txt .
For your project you'll have an easier time using the EVP Digest functions.
The trick is to use a read/write loop:
1) read input data
2) use EVP_DigestUpdate() to pass that data to the encryption routine
3) use EVP_DigestFinal_ex() to get the encrypted data out
4) write the output data to file
5) repeat as necessary
Pay attention to setup and clean up of your buffers on each iteration.