Modify te scanhash API to use an int64_t and return -1 on error, allowing zero to be a valid return value.