Ported SHA-1

Builds well though potential bugs may still be there.