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

  • Home
  • SEARCH
  • 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 7047297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:45:15+00:00 2026-05-28T02:45:15+00:00

I have been stuck for a day now on implementing openssl(on windows) md5. Such

  • 0

I have been stuck for a day now on implementing openssl(on windows) md5. Such a simple thing seems like its taking forever. It crashes @ MD5_Update when ran. Is there something I am missing, and if I am, any helpful tips to improve my code so I never do it again? I followed these documents: http://www.openssl.org/docs/crypto/md5.html Thanks. I really do appreciate it. 🙂

#include <iostream>
#include <iomanip>
#include <openssl/md5.h>
using namespace std;

int main()
{
    unsigned char data[] = {0xd1, 0x31, 0xdd, 0x02, 0xc5, 0xe6, 0xee, 0xc4, 0x69, 0x3d, 0x9a, 0x06, 0x98, 0xaf, 0xf9, 0x5c};
    unsigned char hash[16];
    MD5_CTX *c;
    MD5_Update(c,data,16);
    MD5_Final(hash, c);

    for(int i=0;i<16;i++)
    cout << setfill('0') << setw(2) << hex << (int)hash[i] << " ";

    int a;
    cin >> a;
    return 0;
}
  • 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-28T02:45:16+00:00Added an answer on May 28, 2026 at 2:45 am

    You never create, nor do you allocate space to hold, the MD5 context.

    MD5_CTX *c;
    MD5_Update(c,data,16);
    

    You can’t use a variable before you assign it a value! After your first line, c has some arbitrary junk value, which you then pass to MD5_Update!

    Try:

    MD5_CTX c;
    MD5_Init(&c);
    MD5_Update(&c, data, 16);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Been stuck with this fairly simple MySQL query for a day now! Can't believe
I've been stuck on this all day. I have a setup like the one
I've been stuck with this for weeks now and have no idea where I'm
I'm stuck on this and have been all day.. I'm still pretty new to
I've been stuck on this for a day now! I'm just getting started with
I have been stuck on this for a day or two, I have recently
Ok so ive been at this problem from a day or so now, seems
I have been frustrated by this for like a day...please help. I have an
I've been stuck on this all day, and have just run out of ideas.
i've been stuck with this problem for like a day, not finding any relevant

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.