SHA1 library: fixing incorrect buffer size allocation, and unsafe integer size type

This library has some bugs including an incorrectly allocated buffer, and a potential buffer overflow due to an unsafe integer size type.  This mirrors the fixes at https://github.com/slowriot/sha1 (fork of https://github.com/vag/sha1)