0

i want to get first character of original string from hashe sha512. The format of my original string is it have 32 characters. first character in set of { 1, 2, 3, 4...9, T,J,Q,K } the second character in set of { D, S, H, C } the third character is "-" and last characters in set of { a to z, A to Z, 0 to 9 } i want input is "e9353e5aa1dedb3eb4767da8d21b81d7dbf10fa8f23e4704084c989edf5293a46f41f8b3c77c6f828ccf1f688585a52fe0b0601b0c2485af656579bb9b5cd48f" this is hashed string of "1S-74iaoSurg6nVxMzkqwVQMcmWvzmpP"

i want output is "1"

I will be grateful if somebody help me out in this. Thanks

daniel
  • 1
  • You'd have to test all possible input combinations until you find one with the same hash. That should be fine if you have about 10^40 years of computing power available at 1 million guesses per second. – Marc Oct 22 '20 at 07:35
  • is there not any easy way...? – daniel Oct 22 '20 at 07:38
  • Of course not, this is a hash, and a modern one. If there was an easy way, it would be really broken. – Marc Oct 22 '20 at 07:38
  • actually i'm working on a project and this is my ultimate motive...it seems impossible then – daniel Oct 22 '20 at 07:40
  • 1
    This sounds like a [XY problem](https://en.m.wikipedia.org/wiki/XY_problem). Explain what you want to achieve, don't ask how to break a modern hash function. – Marc Oct 22 '20 at 07:41
  • If each of your remaining 29 characters { a to z, A to Z, 0 to 9 } has equal probability, brute force will not work (any time soon), but if that last part of the message has some structure you could reduce your search space. – David Soroko Oct 27 '20 at 09:10

1 Answers1

2

You can only get the input for the output of a one-way hash function by trying every input value (if possible in the order of likelihood).

There are 13 options for that first character, 4 for the next one, and 62 characters in the final 29 characters of the string. We can disregard the single dash.

That makes 13 * 4 * 62 ^ 29 = ~5 × 10^53 possibilities to test. So if this is all you have that makes this impossible to solve. It's equivalent to breaking a 178 bit AES key (calculate by taking the 2-log of the number of possibilities, or by dividing 53 by about 3 and then multiplying with 10 for a quick approximation), if such a thing would exist.

kelalaka
  • 5,064
  • 5
  • 27
  • 44
Maarten Bodewes
  • 90,524
  • 13
  • 150
  • 263
  • Log2(13 * 4 * 62 ^ 29)+1 ~= 179. log2 bits requires an addition. There is a \lfoor that I cannot write here. – kelalaka Oct 22 '20 at 10:43
  • It's over 128, that's all that's important here :P. Um, sorry, better round *down* when it comes to estimating strength. Or explain the +1? – Maarten Bodewes Oct 22 '20 at 11:55