3
$\begingroup$

Given a set of SHA1 hash code, if we knew a portion of the plaintext for each particular hash code, and also the remaining portion of the plaintext is a constant value for each hash code. Is it possible for us to recover what is the constant value?

$\endgroup$
5
  • 2
    $\begingroup$ I guess it depends how long the constant value is... $\endgroup$
    – Thomas
    Commented Oct 29, 2012 at 19:16
  • 2
    $\begingroup$ Brute force will do it. How long it takes depends on how many bits there are in the constant value. $\endgroup$
    – rossum
    Commented Oct 29, 2012 at 21:03
  • 1
    $\begingroup$ Maybe if you look really really deep into cryptographic analysis of SHA-1 you may shave off a few bits (this may require a masters degree and oodles of memory), but I think normally you are stuck with brute forcing the constant value. If you find a SHA-1 match though you are certain that you've found the right value. $\endgroup$
    – Maarten Bodewes
    Commented Oct 29, 2012 at 21:36
  • $\begingroup$ Said if I know only first character are different remaining are the same, will it decrease the brute fore time? $\endgroup$
    – user236501
    Commented Oct 30, 2012 at 5:58
  • 1
    $\begingroup$ @user236501: No, every character constant in message except one does not help significantly. Essentially, the best attack we can think of so far is to enumerate the possible values for the constant unknown portion of the message. $\endgroup$
    – fgrieu
    Commented Oct 30, 2012 at 8:08

1 Answer 1

2
$\begingroup$

Yes, but unless there is a significant break through in the crypto-analysis of SHA-1, the only way to retrieve the constant value is by brute forcing it. In other words, trying all the values, calculating the SHA-1 over the plaintext and the constant and comparing it with the given hash value.

$\endgroup$
6
  • 2
    $\begingroup$ Just because nobody seemed to care to actually make their comments an answer :) $\endgroup$
    – Maarten Bodewes
    Commented Oct 31, 2012 at 0:13
  • $\begingroup$ But we don't know the message length still possible? Any message length will still hash into same bit output right? it is a 40 character output. $\endgroup$
    – user236501
    Commented Oct 31, 2012 at 0:48
  • $\begingroup$ @user236501 No, but if the constant value is short enough we'll reach it eventually, by going "try every 1-character combination... OK we've tried them all and nothing worked, move on to every 2-character combination" and so on. $\endgroup$
    – Thomas
    Commented Oct 31, 2012 at 5:00
  • $\begingroup$ I found a SHA1 extension attack, if said the hash format is (a||b||constant value), is it possible that I create another hash code (c||b||constant value) without knowing the constant value. $\endgroup$
    – user236501
    Commented Oct 31, 2012 at 5:19
  • $\begingroup$ @user236501 Possibly, but you wouldn't learn anything about the constant value doing that. $\endgroup$
    – Thomas
    Commented Dec 5, 2012 at 9:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.