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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T08:58:43+00:00 2026-05-12T08:58:43+00:00

Given two different messages, A and B (maybe 20-80 characters of text, if size

  • 0

Given two different messages, A and B (maybe 20-80 characters of text, if size matters at all), what is the probability that the MD5 digest of A is the same as the MD5 digest of B and the SHA1 digest of A is the same as the SHA1 digest of B? That is:

(MD5(A) == MD5(B)) && (SHA1(A) == SHA1(B))

Assume no malicious intent, i.e., that the messages are not selected with an aim of finding a clash. I just want to know the odds of this happening naturally.

I’m thinking the chances are “astronomically low,” but I’m not sure how to verify this.

More information: the size of the pool of possible messages is restricted, but large (several hundred million). Birthday paradox situations are exactly what I’m worried about.

  • 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-12T08:58:44+00:00Added an answer on May 12, 2026 at 8:58 am

    Assuming uniform spread in the range of MD5 and SHA-1 hashes for random strings (which isn’t the case), and assuming we’re only talking about two strings and not talking about a pool of strings (so we avoid birthday-paradox-type complexities):

    An MD5 hash is 128 bits wide, and SHA-1’s is 160. With the above assumptions, two strings A and B have a probability of colliding P if both hashes collide. So

    P(both collide) = P(MD5 collides) * P(SHA-1 collides)
    

    And

    P(MD5 collides) = 1/(2^128)
    P(SHA-1 collides) = 1/(2^160)
    

    So

    P(both) = 2^-128 * 2^-160 = 2^-288 ~= 2.01 x 10^-87
    

    Again, if you have a pool of strings and you’re trying to determine the probabilities of collisions with the pool, you’re in the domain of the birthday paradox and this probability I’ve calculated here doesn’t apply. That and hashes aren’t as uniform as they should be. In reality you’re going to have a much higher collision rate, but it will still be tiny.


    EDIT

    Since you are dealing with a birthday paradox situation, apply the same logic as the solution to the birthday paradox. Let’s look at it from the point of view of just one hash function:

    N := the number of hashes in your pool (several hundred million)
    S := the size of your hash space (2^288)
    Therefore,
    P(There are no collisions) = (S!)/(S^N * (S - N)!)
    

    Let’s pretend we have a nice even number of hashes like 2^29 (roughly 530 million).

    P = (2^288!)/(2^288^(2^29) * (2^288 - 2^29)!)
    

    In short, I don’t even want to think about calculating this number. I’m not even sure how you can go about estimating it. You’ll at least need an arbitrary-precision calculator that can handle huge factorials without dying.

    Note that the probabilities will follow a curve that starts at nearly 0 when N = 1 or 2, and it will reach 1 when N >= 2^288, similar in shape to the one on the Wikipedia page for the birthday paradox.

    The birthday paradox reaches P = .5 when N = 23. In other words, the probability of a collision is 50% when N is 6% of S. If that scales (I’m not sure if it does), it means that there will be a 50% chance of a collision when you have 6% of 2^288 hashes. 6% of 2^288 is around 2^284. Your value of N (several hundred million) is nowhere near that. It’s practically insignificant compared to your S, so I don’t think you have anything to worry about. Collisions aren’t very likely.

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

Sidebar

Related Questions

I have two systems that produce different types of messages that I need to
I have two views that returns the same columns, but different rows. I am
Given two lists of different types, is it possible to make those types convertible
Given two tuples of the same arity, how can I lexicographically compare them? It
Given: two images of the same subject matter; the images have the same resolution,
Given two methods on the same class in Java : public void doSomething( Person
Here's my send email function that sends the email however i have two different
I am compiling the same project under two different compilers. The snippet below compiles
I am writing a web application in java that has two different type of
What is the difference between these two queries? Why do they give different results?

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.