Change some private exports, use sha1 crate

Stop using own implementation
Add some more test code, make doc examples work in --test mode