Use state to update hash value at the end rather than memory