# How to explain the steps in the implementation of hashing functions like SHA1

I was reading the article about the SHA1 hashing function (I know it is not secure anymore) and I've found a pseudocode implementation on Wikipedia.

I can see that there are a lot of mathematical operations, and what I wanted to know is the justification of each step in this hashing function. I want to know, for example, how each part increases the security of the function. How do we know that these operations are gonna produce a drastic change in the output when a minimum change is made in the input?

Is there a book about the theory behind hashing function? Maybe a book that explains mathematical functions or operations that maps the input to a very large output space such that is very hard to do the inverse way.

Is there a very simple hashing function that can be studied and that are examples of attacks? Is there some paper that explains the evolution of these functions and the justification for some math operations in this?

• Please focus your question to one: do you want a reference? Do you want an explanation of SHA1? Do you want a simple example of a hash that's easy to break? Pick one and trim your post; you can easily post the others on their own.
– Raphael
Sep 11 '14 at 10:18
• Regarding "where does security come from?", it's unlikely that there is some line in the code that "makes it secure" or that you could say "this line adds 10% security, that one 20%" (what would that even mean?). Inspecting the pseudocode may not be very instructive: most likely there's some mathematical (number theoretic?) property that is being exploited, and the code just "does the numbers". But I'll let crypto experts answer that in more detail.
– Raphael
Sep 11 '14 at 10:19
• @Raphael that's it: I need to know about these mathematical properties! Sep 11 '14 at 20:10