Optimize md5 and sha1, and improve their test suites.