add reentrant variants of sha1_to_hex and find_unique_abbrev