Description of The Algorithm
As mentioned above, this algorithm computes a checksum by segmenting the data and adding it to an accumulator that is circular right shifted between each summation. To keep the accumulator within return value bounds, bit-masking with 1's is done.
Example: 4-bit checksum using 4-bit sized segments (big-endian:Endianness)
Loop 1:
checksum: 0000 seg: 1011a) Circular shift checksum:
0000 -> 0000b) Add seg and bitmask:
0000 + 1011 = 1011 -> 1011 & 1111 = 1011Loop 2:
checksum: 1011 seg: 1000a) Circular shift checksum:
1011 -> 1101b) Add seg and bitmask:
1101 + 1000 = 10101 -> 10101 & 1111 = 0101Loop 3:
checksum: 0101 seg: 1110a) Circular shift checksum:
0101 -> 1010b) Add seg and bitmask:
1010 + 1110 = 11000 -> 11000 & 1111 = 1000Checksum: 1000
Read more about this topic: BSD Checksum
Famous quotes containing the words description of the, description of and/or description:
“Do not require a description of the countries towards which you sail. The description does not describe them to you, and to- morrow you arrive there, and know them by inhabiting them.”
—Ralph Waldo Emerson (18031882)
“To give an accurate description of what has never occurred is not merely the proper occupation of the historian, but the inalienable privilege of any man of parts and culture.”
—Oscar Wilde (18541900)
“It is possibleindeed possible even according to the old conception of logicto give in advance a description of all true logical propositions. Hence there can never be surprises in logic.”
—Ludwig Wittgenstein (18891951)