BSD Checksum - Description of The Algorithm

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)

Input: 101110001110

Loop 1:

checksum: 0000 seg: 1011

a) Circular shift checksum:

0000 -> 0000

b) Add seg and bitmask:

0000 + 1011 = 1011 -> 1011 & 1111 = 1011

Loop 2:

checksum: 1011 seg: 1000

a) Circular shift checksum:

1011 -> 1101

b) Add seg and bitmask:

1101 + 1000 = 10101 -> 10101 & 1111 = 0101

Loop 3:

checksum: 0101 seg: 1110

a) Circular shift checksum:

0101 -> 1010

b) Add seg and bitmask:

1010 + 1110 = 11000 -> 11000 & 1111 = 1000

Checksum: 1000

Read more about this topic:  BSD Checksum

Famous quotes containing the words description of the, description of and/or description:

    The next Augustan age will dawn on the other side of the Atlantic. There will, perhaps, be a Thucydides at Boston, a Xenophon at New York, and, in time, a Virgil at Mexico, and a Newton at Peru. At last, some curious traveller from Lima will visit England and give a description of the ruins of St. Paul’s, like the editions of Balbec and Palmyra.
    Horace Walpole (1717–1797)

    The type of fig leaf which each culture employs to cover its social taboos offers a twofold description of its morality. It reveals that certain unacknowledged behavior exists and it suggests the form that such behavior takes.
    Freda Adler (b. 1934)

    Once a child has demonstrated his capacity for independent functioning in any area, his lapses into dependent behavior, even though temporary, make the mother feel that she is being taken advantage of....What only yesterday was a description of the child’s stage in life has become an indictment, a judgment.
    Elaine Heffner (20th century)