tarfile.calc_chksums()

tarfile.calc_chksums(buf)[source]

Calculate the checksum for a member’s header by summing up all characters except for the chksum field which is treated as if it was filled with spaces. According to the GNU tar sources, some tars (Sun and NeXT) calculate chksum with signed char, which will be different if there are chars in the buffer with the high bit set. So we calculate two checksums, unsigned and signed.