The symmetry of 1's complement arithmetic also means that after
modifying a *FITS* file, the checksum may be incrementally updated
using simple arithmetic without accumulating the checksum for portions
of the file that have not changed.

An incremental update provides the mechanism for end-to-end checksum
verification through any number of intermediate processing steps.
By *calculating* rather than *accumulating* the intermediate
checksums, the original checksum test is propagated through to the
final data file. On the other hand, if a new checksum is accumulated
with each change to the file, no information is preserved about
the file's original state.

The recipe for updating the `CHECKSUM` keyword following some
change to the file is: *C*' = *C* - *m* + *m*', where *C* and
*C*' represent the file's checksum (that is, the complement
of the `CHECKSUM` keyword) before and after the modification and
*m* and *m*' are the corresponding checksums for the modified
*FITS* records or keywords only. Since the `CHECKSUM` keyword
contains the complement of the checksum, the correspondingly complemented
form of the recipe is more directly useful:
, where (tilde) denotes the (1's) complement operation. (See ref. 12-14.)
Note that the tilde on the right hand side of the equation cannot be
distributed over the contents of the parentheses due to the dual nature
of zero in 1's complement arithmetic (ref. 14).

FITS Documents