Throw exception on hash mismatch.