md5sum of file in Linux C -
I want to find the md5sum of a file in linux, whether there is an API, where I get the file to get the MD5 subsystem I can send the name of that file.
is the code.
In addition, openssl libs have md5 functions (from):
#include & lt; Openssl / md5.h & gt; # Include & lt; Unistd.h & gt; Int main () {int n; MD5_CTX c; Four buff [512]; Ssize_t bytes; Unsigned four out [MD5_DIGEST_LENGTH]; MD5_Init (& amp; c); Bytes = Read (STDIN_FILENO, buf, 512); While (bytes> 0) {MD5_Update (& amp; c; buf, bytes); Bytes = Read (STDIN_FILENO, buf, 512); } MD5_Final (outside, & amp; c); For (n = 0; n & lt; MD5_DIGEST_LENGTH; n ++) printf ("% 02x", outside [N]); Printf ("\ n"); Return (0); }
Comments
Post a Comment