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 8677569
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:29:31+00:00 2026-06-12T20:29:31+00:00

I need to implement a hash function that produces a 32 bit (sufficiently unique)

  • 0

I need to implement a hash function that produces a 32 bit (sufficiently unique) value to be used a message identifier when sending a message. I maintain a sequence number and keep incrementing it along with some other variables and sum them up and want to get a hash of the total (I am planning to use MD5 for this and then pick the first 32 bits of the output). However I see that the MD5 function in Linux only takes string input,

MD5((unsigned char*)data, strlen(data), result);

I have thought of sprintf’ing the ‘total’ and then calculating the hash, but would like to know if there is some function to directly compute the MD5 of the numeric value of ‘total’?

  • 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-06-12T20:29:33+00:00Added an answer on June 12, 2026 at 8:29 pm

    unsigned char * does not imply a string, or a null-terminated string. At least not in this context. It is just a pointer to N number of 8-bit words with no value restrictions whatsoever. And so, you don’t have to have any snprintf or anything like that in order to convert your data into ASCII strings. If it helps, here is the source of md5sum tool.

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

Sidebar

Related Questions

I need to implement hash value i.e the Url should look like this: /home/index/#create
I'm working on a .NET 3.5 project and I need a 32-bit hash value.
I need to implement a hash table and hash function using JavaScript. The goal
I need to implement a hash table to maintain IP packets. However, due to
i need to implement a messaging scenario that consumes messages from throusands of destinations
I need to implement a method to find the MD5 hash of the bytes
I need to implement equals() method for an Item that may be put in
I need to implement a couple of functions which comply with the following: function
I need a secure (cryptographic) hash function with the following properties: Can be coded
I need to implement portable code, but I do not know how to deal

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.