Thursday, May 8, 2014

Linux - File Checksum

The purpose of file checksums is to validate integrity of files. There are many ways to do checksums on Linux, but the simplest is by using md5sum command (for MD5 checksum). Format is:
md5sum [options] [file1] ... [file n]

Options are:
-b or --binary - binary mode
-t or --text - text mode (default)
-c or --check - read file with checksums and check them

For test purpose make one file named test

$ md5sum test
ee10c66475e841d934c0e39d07650d4a  test

output md5 checksum to file:
$ md5sum test >checksum

check:
$md5sum -c checksum
test: OK

MD5 gives 128 bit checksum. For security related purposes is better to use SHA-2 algorithm implemented in: sha224sum, sha256sum, sha384sum and sha512sum programs.








No comments:

Post a Comment