bash md5sum string

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <openssl/md5.h>

// Function to calculate MD5 hash of a string
char calculate_md5(const char input) {
    MD5_CTX context;
    MD5_Init(&context);
    MD5_Update(&context, input, strlen(input));

    unsigned char digest[MD5_DIGEST_LENGTH];
    MD5_Final(digest, &context);

    char result = (char)malloc(2 * MD5_DIGEST_LENGTH + 1);
    for (int i = 0; i < MD5_DIGEST_LENGTH; i++) {
        sprintf(result + 2 * i, "%02x", digest[i]);
    }
    result[2 * MD5_DIGEST_LENGTH] = '\0';

    return result;
}

int main() {
    const char* input_string = "Hello, World!";
    char* md5_hash = calculate_md5(input_string);

    printf("MD5 Hash of '%s': %s\n", input_string, md5_hash);

    // Remember to free the allocated memory
    free(md5_hash);

    return 0;
}