Fix numerous SHA1 bugs

It's still not working.  But it's closer than it was.  It's getting
the wrong hash, but nothing crashes.