Rewrite OFSHA1Hash

The old one was based on a public domain implementation, which is
optimized for old compilers and quite unreadable. The new one is written
from scratch and designed to be readable and to exploit optimizations of
modern compilers.