i get 2 different values when i give cksum and sum command. Are they 2 different algorithms? can someone explain how this is different
Please have a look at the starting lines of man pages for the both.
you will find clear explanation there.
like,
cksum uses a portable algorithm based on a 32-bit Cyclic Redundancy
Check. This algorithm finds a broader spectrum of errors than the
16-bit algorithms used by sum (see sum(1)). The CRC is the sum of the
following expressions, where x is each byte of the file.
x^32 + x^26 + x^23 +x^22 + x^16 + x^12 + x^11 + x^10 + x^8 + x^7
+ x^5 + x^4 + x^2 + x^1 + x^0
The algorithms are quite different.
sum just adds up the binary equivalent of the bytes.
chsum is a proper CRC check.
sum will not spot byte reversal or even lines swapped over. cksum will.