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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T09:14:11+00:00 2026-05-21T09:14:11+00:00

For any Hash function, conceptually speaking or otherwise, What is the difference between aforementioned

  • 0

For any Hash function, conceptually speaking or otherwise, What is the difference between aforementioned 2 operations. I have approached the problem in the following manner:

H=hash(someplaintext)
n=0
while 1:
    if hash(str(n))==H:
        print n
    n+=1

Both the properties could be proven this way, is there something wrong? Ignore the efficiency, memory usage or any such property. Please answer my question, strictly on the basis of correctness

  • 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-21T09:14:11+00:00Added an answer on May 21, 2026 at 9:14 am

    “One-way” means that given a function output, you cannot find a matching input, except by trying many potential inputs and getting lucky. A collision is about finding two distinct inputs which yield the same output, without any predefined constraint on said output.

    There are three classical properties which a good (cryptographic) hash function should have:

    • Resistance to preimages: given x, it should be infeasible to find m such that h(m) = x.
    • Resistance to second preimages: given m, it should be infeasible to find m’ distinct from m, such that h(m) = h(m’).
    • Resistance to collisions: it should be infeasible to find m and m’, distinct from each other, such that h(m) = h(m’).

    This can be viewed as three challenges for the attacker, sorted by decreasing difficulty. For preimages, I give you an output, and I challenge you to find a matching input. For second preimage, I give you an input (and implicitly the corresponding output), and I challenge you to find another matching input. For collisions, this is like the second preimage challenge, except that I do not require that you find a specific output; any one will do. Or, to state it the other way round: a challenge for a second preimage is like a challenge for a collision in which one of the colliding messages cannot be freely chosen by the attacker.

    Without exploiting any weakness in the hash function itself, the generic methods for finding preimages, second preimages, and collisions, for a hash function with a n-bit output, have cost roughly 2n (for preimages and second preimages) and 2n/2 (for collisions). Finding collisions is thus vastly easier. For preimages, you just try inputs until you get lucky (that’s what you call “brute force”); each try has probability 2-n to succeed. For collisions, this relates to the birthday attack: basically, once you have accumulated about sqrt(2n) pairs input/output, the probability of two of those pairs having the same output rises quite fast.

    In terms of birthdays, this means that if you take 20 people at random, chances are high that two of them will have the same birthday — but you do not get to choose which day or which people. On the other hand, if you want to find someone with the same birthday than you, then you will have to sample through 365 people on average.

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

Sidebar

Related Questions

I have the following hash function, and I'm trying to get my way to
What is the difference between a multi-collision in a hash function and a first
is there any function in C++ that calculates a fingerprint or hash of a
I'm searching for a hash function that takes as input any integer (positive or
I have this custom function to calculate MD5 hash, written in Java. I can't
Are there any known hash algorithms which input a vector of int's and output
Is there any method to generate MD5 hash of a string in Java?
Is there any way to use a constant as a hash key? For example:
If I notice that a hash table (or any other data structure built on
Are there any built-in C# data structures that are like a hash table but

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.