make sha1 endian-insensitive.  Add  test_sha1.cpp.  Fix bugs in discard