Convert a number to sha-1 I have a task to find a the message for which the SHA-1 hash's last 11 symbols in hexadecimal presentation corresponds to an 11-digit number.

I have been given the following example solution:


  For the code 38607310235, a solution is a513b8c4507ea2891fb34cd4612e038607301235, which is the hash of $y$


How can I find $y$?
There is no why it is identical. The input form of the data does not influence what the output of a secure hash function should look like. The input of a hash should be unrelated to the output except for the mapping performed in the hash function itself. There should be no method of calculating the output other than to execute the hash function.

The best way to find another hash with the same property is to brute force it; go through a lot of numbers, convert them to bytes, calculate the hash and compare against the hexadecimal representation of the output. As each hexadecimal digit represents 4 bits, you would have to perform $2^{44}$ calculations (as I don't see how the birthday paradox would help you here). Note that, as CodesInChaos mentioned in a comment, that rainbow tables could speed up searches for cases where the input has properties that are reflected in the output.

If you get the wrong hash output, then it is likely that your conversion from the given number to bytes is failing. You may want to try another encoding.