If you are compiling a c propgram which calculates MD5 using a c program, there are higher chances you will encounter an errors like below, /tmp/cc1eHvha.o: In function calculate_file_md5': md5-calculate.c:(.text+0x7b): undefined reference to MD5_Init' md5-calculate.c:(.text+0x9d): undefined reference to MD5_Update' md5-calculate.c:(.text+0xe1): undefined reference to MD5_Final' collect2: error: ld returned 1 exit status The MD5 functionality is part of OpenSSL cryptographic library. The OpenSSL crypto library implements a wide range of cryptographic algorithms used in various Internet standards. The services provided by this library are used by the OpenSSL implementations of SSL, TLS and S/MIME, and they have also been used to implement SSH, OpenPGP, and other cryptographic standards.
Execution & Command Syntax
sed in various Internet standardssed by the OpenSSL implementations of SSL, TLS and S/MIME, and they have also been used to implement SSH, OpenPGP, and other cryptographic standardsgcc -o md5-calculate md5-calculateTechnical Implementation Details
libcrypto consists of a number of sub-libraries that implement the individual algorithms. The functionality includes symmetric encryption, public key cryptography and key agreement, certificate handling, cryptographic hash functions, cryptographic pseudo-random number generator, and various utilities. Solution : You are missing to link the crypto library ( -lcrypto ) during the command line compilation, hence link the same as, $ gcc -o md5-calculate md5-calculate.c -lcrypto You may refer to “ C program to calculate md5 of a file and check if it matches with predefined / downloaded md5sum “
Gotchas and Common Issues
Permission Verification - confirm execution permissions and path variables before invoking system binaries.
Version Compatibility - check software version release notes for deprecated flags or syntax changes.
Log Monitoring - inspect system logs (
journalctlor/var/log) to troubleshoot execution failures.
Following these steps ensures clean configuration, proper security boundaries, and reliable execution for solve : undefined reference to `md5_init’.
Comments and corrections