Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6756831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:34:18+00:00 2026-05-26T13:34:18+00:00

I need to hash with md5 algorithm a string in my program. There is

  • 0

I need to hash with md5 algorithm a string in my program.
There is the lib openssl but I’m a newbie about it.
How is possible hash a string using that and where I can find a good doc that teach me how to use this lib, also with other function like aes?

I’ve tried this code:

int main()
{
    unsigned char result[MD5_DIGEST_LENGTH];
    const unsigned char* str;
    str = (unsigned char*)"hello";
    unsigned int long_size = 100;
    MD5(str,long_size,result);
}

But the compiler told me:
undefined reference to MD5.

Why is there and undefined reference to MD5?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T13:34:19+00:00Added an answer on May 26, 2026 at 1:34 pm

    You should take a look at the documentation. An option is to use this function:

    #include <openssl/md5.h>
    unsigned char *MD5(const unsigned char *d, 
                       unsigned long n,
                       unsigned char *md);
    

    To which they state:

    MD2(), MD4(), and MD5() compute the MD2, MD4, and MD5 message digest of the n bytes at d and place it in md (which must have space for MD2_DIGEST_LENGTH == MD4_DIGEST_LENGTH == MD5_DIGEST_LENGTH == 16 bytes of output). If md is NULL, the digest is placed in a static array.

    As for AES, if you also want to use OpenSSL, then take a look at EVP doc and this example of how to use it. Just note that you have to add

    #define AES_BLOCK_SIZE 16
    

    In the top of the file for it to work, though.

    Btw. I can really recommend the Crypto++ library since it’s great and has all kinds of cryptographic primitives; AES, Elliptic Curves, MAC, public-key crypto and so on.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: MD5 algorithm in Objective C I need to hash a string using
I need an hash algorithm that outputs an alphanumeric string that is max 20
Is there a way to generate a hash of a string so that the
I need to encode md5 hash to base 64. The problem is that if
I need a hash that can be represented in less than 26 chars Md5
I want to compute an md5 hash not of a string, but of an
I am trying to generate a Unix-Style password hash using MD5. I undestand that
I need to hash (MD5) all the password in our Sql Server 2000 database.
I need to create a keyed hash for a string of XML to send
Need MD5 hash for an in memory System.Drawing.Image

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.