add sha1 test, rewrite test, change api