cksum in Mac OS X

By: Strauss K Emailed: 1696 times Printed: 2196 times    

Latest comments
By: rohit kumar - how this program is work
By: Kirti - Hi..thx for the hadoop in
By: Spijker - I have altered the code a
By: ali mohammed - why we use the java in ne
By: ali mohammed - why we use the java in ne
By: mizhelle - when I exported the data
By: raul - no output as well, i'm ge
By: Rajesh - thanx very much...
By: Suindu De - Suppose we are executing

Display file checksums and block counts. 
Writes to the standard output three (whitespace separated) fields for each input file: CRC_checksum Total_no_of_octets Filename

Syntax
       cksum [-o 1 | 2 | 3] [file ...]

       sum [file ...]

The sum utility is identical to cksum, except that it defaults to using historic algorithm 1, as described below. It is provided for compatibility only.

Options
   -o     Use historic algorithms 1, 2 or 3 instead of the (superior) default one.

   file   The file(s) to checksum
          If no file  is specified, the standard input is used and no file name is written.

Algorithm 1 is the algorithm used by historic BSD systems as the sum(1) algorithm and by historic AT&T System V UNIX systems as the sum(1) algorithm when using the -r option. This is a 16-bit checksum, with a right rotation before each addition; overflow is discarded.

Algorithm 2 is the algorithm used by historic AT&T System V UNIX systems as the default sum(1) algorithm. This is a 32-bit check-sum, and is defined as follows:

s = sum of all bytes;
r = s % 2^16 + (s % 2^32) / 2^16;
cksum = (r % 2^16) + r / 2^16;

Algorithm 3 is what is commonly called the `32bit CRC' algorithm. This is a 32-bit checksum.

Both algorithm 1 and 2 write to the standard output the same fields as the default algorithm except that the size of the file in bytes is replaced with the size of the file in blocks. For historic reasons, the block size is 1024 for algorithm 1 and 512 for algorithm 2. Partial blocks are rounded up.

Notes
exit 0 on success, and >0 if an error occurs. 
The default CRC used is based on the polynomial used for CRC error checking in the networking standard ISO/IEC 8802-3:1989 
The checksum encoding algorithm is explained in the full cksum man page.


macos Home | All macos Tutorials | Latest macos Tutorials

Sponsored Links

If this tutorial doesn't answer your question, or you have a specific question, just ask an expert here. Post your question to get a direct answer.



Bookmark and Share

Comments(0)


Be the first one to add a comment

Your name (required):


Your email(required, will not be shown to the public):


Your sites URL (optional):


Your comments:



More Tutorials by Strauss K
cut in Mac OS X
curl in Mac OS X
crontab in Mac OS X
cron in Mac OS X
cp in Mac OS X
continue in Mac OS X
complete in Mac OS X
command in Mac OS X
comm in Mac OS X
cmp in Mac OS X
cksum in Mac OS X
chroot in Mac OS X
chown in Mac OS X
chmod in Mac OS X
chgrp in Mac OS X

More Tutorials in macos
Getting PHP running on Mac OS 10.1
Installing gedit for python programming in Mac OS X
What is Mac OS X?
History of Mac OS X
Major features of Mac OS X
Different Versions of Mac OS X
What is new in Mac OS X Snow Leopard
alias, unalias in Mac OS X
apropos in Mac OS X
awk in Mac OS X
basename in Mac OS X
bash in Mac OS X
bg in Mac OS X
bless in Mac OS X
break in Mac OS X

More Latest News
Most Viewed Articles (in macos )
bless in Mac OS X
chown in Mac OS X
cksum in Mac OS X
cmp in Mac OS X
complete in Mac OS X
cp in Mac OS X
curl in Mac OS X
Installing gedit for python programming in Mac OS X
What is Mac OS X?
History of Mac OS X
Major features of Mac OS X
Different Versions of Mac OS X
What is new in Mac OS X Snow Leopard
alias, unalias in Mac OS X
apropos in Mac OS X
Most Emailed Articles (in macos)
chroot in Mac OS X
cp in Mac OS X
What is Mac OS X?
builtin in Mac OS X
cal, ncal in Mac OS X
cat in Mac OS X
complete in Mac OS X
continue in Mac OS X
crontab in Mac OS X
Installing gedit for python programming in Mac OS X
History of Mac OS X
Major features of Mac OS X
Different Versions of Mac OS X
What is new in Mac OS X Snow Leopard
awk in Mac OS X