Only call digest.input when necessary