Cksum
Encyclopedia
cksum' is a command in Unix-like
operating systems that generates a checksum
value for a file or stream of data. The cksum command reads each file given in its arguments, or standard input
if no arguments are provided, and outputs the file's CRC
checksum and byte
count.
The cksum command can be used to verify that files transferred by unreliable means arrived intact. However, the CRC checksum calculated by the cksum command is not cryptographically secure
: While it guards against accidental corruption (it is unlikely that the corrupted data will have the same checksum as the intended data), it is not difficult for an attacker to deliberately corrupt the file in a specific way that its checksum is unchanged. Unix-like systems typically include other commands for cryptographically secure checksums, such as md5sum
and sha1sum
.
standard frame check and is therefore interoperable between implementations. This is in contrast to the sum command
, which is not as interoperable. On Tru64 operating systems, the cksum command returns a different CRC value, unless the environment variable
"4038471504" represents the checksum value. "75" represents the file size of test.txt.
Unix-like
A Unix-like operating system is one that behaves in a manner similar to a Unix system, while not necessarily conforming to or being certified to any version of the Single UNIX Specification....
operating systems that generates a checksum
Checksum
A checksum or hash sum is a fixed-size datum computed from an arbitrary block of digital data for the purpose of detecting accidental errors that may have been introduced during its transmission or storage. The integrity of the data can be checked at any later time by recomputing the checksum and...
value for a file or stream of data. The cksum command reads each file given in its arguments, or standard input
Standard streams
In Unix and Unix-like operating systems , as well as certain programming language interfaces, the standard streams are preconnected input and output channels between a computer program and its environment when it begins execution...
if no arguments are provided, and outputs the file's CRC
Cyclic redundancy check
A cyclic redundancy check is an error-detecting code commonly used in digital networks and storage devices to detect accidental changes to raw data...
checksum and byte
Byte
The byte is a unit of digital information in computing and telecommunications that most commonly consists of eight bits. Historically, a byte was the number of bits used to encode a single character of text in a computer and for this reason it is the basic addressable element in many computer...
count.
The cksum command can be used to verify that files transferred by unreliable means arrived intact. However, the CRC checksum calculated by the cksum command is not cryptographically secure
Cryptographic hash function
A cryptographic hash function is a deterministic procedure that takes an arbitrary block of data and returns a fixed-size bit string, the hash value, such that an accidental or intentional change to the data will change the hash value...
: While it guards against accidental corruption (it is unlikely that the corrupted data will have the same checksum as the intended data), it is not difficult for an attacker to deliberately corrupt the file in a specific way that its checksum is unchanged. Unix-like systems typically include other commands for cryptographically secure checksums, such as md5sum
Md5sum
md5sum is a computer program that calculates and verifies 128-bit MD5 hashes, as described in RFC 1321. The MD5 hash functions as a compact digital fingerprint of a file. As with all such hashing algorithms, there is theoretically an unlimited number of files that will have any given MD5 hash...
and sha1sum
Sha1sum
sha1sum is a computer program that calculates and verifies SHA-1 hashes. It is commonly used to verify the integrity of files. It is installed by default in most Unix-like operating systems...
.
Interoperability
The standard cksum command, as found on most UNIX-like OS (including GNU/Linux, *BSD, Mac OS X, and Solaris) uses a CRC algorithm based on the ethernetEthernet
Ethernet is a family of computer networking technologies for local area networks commercially introduced in 1980. Standardized in IEEE 802.3, Ethernet has largely replaced competing wired LAN technologies....
standard frame check and is therefore interoperable between implementations. This is in contrast to the sum command
Sum (Unix)
Sum is a core GNU utility written by Kayvan Aghaiepour and David MacKenzie and distributed with the UNIX- and Linux-based operating systems. This utility outputs the checksum of each argument file, as well as the number of blocks they take on disk....
, which is not as interoperable. On Tru64 operating systems, the cksum command returns a different CRC value, unless the environment variable
Environment variable
Environment variables are a set of dynamic named values that can affect the way running processes will behave on a computer.They can be said in some sense to create the operating environment in which a process runs...
CMD_ENV
is set to “xpg4
”.Usage example
"4038471504" represents the checksum value. "75" represents the file size of test.txt.
See also
- GNU Core UtilitiesGNU Core UtilitiesThe GNU Core Utilities or coreutils is a package of GNU software containing many of the basic tools, such as cat, ls, and rm, needed for Unix-like operating systems...
md5sum
Md5summd5sum is a computer program that calculates and verifies 128-bit MD5 hashes, as described in RFC 1321. The MD5 hash functions as a compact digital fingerprint of a file. As with all such hashing algorithms, there is theoretically an unlimited number of files that will have any given MD5 hash...sha1sum
Sha1sumsha1sum is a computer program that calculates and verifies SHA-1 hashes. It is commonly used to verify the integrity of files. It is installed by default in most Unix-like operating systems...- Comparison of file verification software