A couple of hashing algorithms I wrote in C in order to more deeply familiarise myself with the inner workings.
These implementations are by no means robust, perhaps not even precise, but they do aim to be correct.
NIST's Secure Hash Standard (SHS) publication can be found here.
RFC3174 SHA1 memo.