I want to compute the md5sum value of a file ,not a string . I found somebody had used openssl md5 function. But it's only used in string . Is there any function that i can use to get the md5sum value of a file which equals using md5sum command in linux.
Asked
Active
Viewed 5,253 times
0
-
Check the code of md5sum or use md5 lib. 1. Read file and save it in a buf 2. Use md5 lib to convert the string -> md5 digest 3. check the below link on how to use MD5API http://stackoverflow.com/questions/7627723/how-to-create-a-md5-hash-of-a-string-in-c – Sasi V Apr 10 '14 at 08:31
1 Answers
3
You can generate md5sum using openssl/md5.h Please refer How to get the MD5 hash of a file in C++?
In this link example is provided for generating md5sum of file using openssl
Also you can use following commands in Linux to generate md5sum of file
openssl dgst -md5 yourfile
md5sum yourfile

Community
- 1
- 1

Rahul R Dhobi
- 5,668
- 1
- 29
- 38