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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:09:55+00:00 2026-05-27T14:09:55+00:00

Just wondering if knowing the original string length means that you can better unlash

  • 0

Just wondering if knowing the original string length means that you can better unlash a SHA1 encryption.

  • 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-27T14:09:55+00:00Added an answer on May 27, 2026 at 2:09 pm

    No, not in the general case: a hash function is not an encryption function and it is not designed to be reversible.

    It is usually impossible to recover the original hash for certain. This is because the domain size of a hash function is larger than the range of the function. For SHA-1 the domain is unbounded but the range is 160bits.

    That means that, by the Pigeonhole principle, multiple values in the domain map to the same value in the range. When such two values map to the same hash, it is called a hash collision.

    However, for a specific limited set of inputs (where the domain of the inputs is much smaller than the range of the hash function), then if a hash collision is found, such as through an brute force search, it may be “acceptable” to assume that the input causing the hash was the original value. The above process is effectively a preimage attack. Note that this approach very quickly becomes infeasible, as demonstrated at the bottom. (There are likely some nice math formulas that can define “acceptable” in terms of chance of collision for a given domain size, but I am not this savvy.)

    The only way to know that this was the only input that mapped to the hash, however, would be to perform an exhaustive search over all the values in the range — such as all strings with the given length — and ensure that it was the only such input that resulted in the given hash value.

    Do note, however, that in no case is the hash process “reversed”. Even without the Pigeon hole principle in effect, SHA-1 and other cryptographic hash functions are especially designed to be infeasible to reverse — that is, they are “one way” hash functions. There are some advanced techniques which can be used to reduce the range of various hashes; these are best left to Ph.D’s or people who specialize in cryptography analysis 🙂

    Happy coding.


    For fun, try creating a brute-force preimage attack on a string of 3 characters. Assuming only English letters (A-Z, a-z) and numbers (0-9) are allowed, there are “only” 623 (238,328) combinations in this case. Then try on a string of 4 characters (624 = 14,776,336 combinations) … 5 characters (625 = 916,132,832 combinations) … 6 characters (626 = 56,800,235,584 combinations) …

    Note how much larger the domain is for each additional character: this approach quickly becomes impractical (or “infeasible”) and the hash function wins 🙂

    One way password crackers speed up preimage attacks is to use rainbow tables (which may only cover a small set of all values in the domain they are designed to attack), which is why passwords that use hashing (SHA-1 or otherwise) should always have a large random salt as well.

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

Sidebar

Related Questions

Just wondering is it possible to build CLI app that can be run from
Just wondering if anyone can optimize this usortMonths() function to be better? Basically I
Just wondering the best way to replace in place matches on a string. value.replace(bob,
Just wondering if theres a program you can paste a JSON response into and
Just wondering if anyone can help me with this slight issue. I'm writing a
I was just wondering if there is anyway that allow me to use the
Just wondering if a .NET app can be compiled down to native machine code
Just wondering. I have a page in Jquery Mobile which uses a popup that
Just wondering if someone can point me in the right direction. I want to
Knowing full well that my InnoDB tables don't support FULLTEXT searches, I'm wondering what

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.