Depending on how "strict" you want the checksum to be, a typical Linux install provides at least three options:
sum - this is a quick and simple checksum. It's not cryptographically secure and so deliberate tampering would be possible, but it should handle file copying errors well enough.
md5sum (sometimes just
md5). This calculates an MD5 based checksum on the file. This is slower than
sum but more resilient. The MD5 algorithm has been broken, but it's not easy.
sha1sum This calculates an SHA1 checksum; even slower but the strongest against tampering.
crc32 This may not be present on all systems; it's a perl program.
In your use case I'd probably stick with
By calculating the checksum on the
tar.gz before transfer and after transfer you have reasonable assurance that the transfer was good (
crc32 are weakest, but good enough).
There's another possibility... since you're compressing the data then you can try and decompress the result at the other end with
gzip -dc file.tar.gz > /dev/null. If this generates an error then the file is corrupt, otherwise it's good. Depending on the size of the file this might be easier because it doesn't require a second file to be transferred. It may not fit your use case, though.