unsigned short ctl_net_calc_cksum(unsigned long seed,
                                  const unsigned short *data,
                                  size_t byte_count);

ctl_net_calc_cksum calculates the checksum over an array of shorts. See RFC 1071. The returned value is 0 through 65535 with all end-around carries accounted for.


Data in and out of checksum functions are in network byte order. Actually, it doesn't matter which byte order is used as long as the answer is the same byte order.

seed contains the value calculated from the TCP or UDP pseudo-header.