Update checksum logic: cache result and return it instead of recomputation.