// SetChecksum sets the ICMP checksum field.
964843
func (b ICMPv4) SetChecksum(checksum uint16) {
	binary.BigEndian.PutUint16(b[2:], checksum)
}
955552
func (s *CreateBotVersionOutput) SetChecksum(v string) *CreateBotVersionOutput {
	s.Checksum = &v
	return s
}
808947
func (s *StatisticSet) SetSum(v float64) *StatisticSet {
	s.Sum = &v
	return s
}
826433
func (s *GetJobOutputOutput) SetChecksum(v string) *GetJobOutputOutput {
	s.Checksum = &v
	return s
}
279181
func (b ICMPv6) SetChecksum(checksum uint16) {
	binary.BigEndian.PutUint16(b[2:], checksum)
}
694848
func EncodeChecksum(checksum string) string {
	return fmt.Sprintf("%s=%s", DigestSHA256, base64.StdEncoding.EncodeToString([]byte(checksum)))
}
29273
func (h *VHDExtraHeader) addChecksum() {
	buffer := new(bytes.Buffer)
	binary.Write(buffer, binary.BigEndian, h)
	checksum := 0
	bb := buffer.Bytes()

	for counter := 0; counter < VHD_EXTRA_HEADER_SIZE; counter++ {
		checksum += int(bb[counter])
	}

	binary.BigEndian.PutUint32(h.Checksum[:], uint32(^checksum))
}
674814
func (s *MetricDatapoint) SetSum(v float64) *MetricDatapoint {
	s.Sum = &v
	return s
}
996873
func (s *PutBotOutput) SetChecksum(v string) *PutBotOutput {
	s.Checksum = &v
	return s
}
1000234
func (p *Packet) UpdateIPChecksum() {

	p.ipHdr.ipChecksum = p.computeIPChecksum()

	binary.BigEndian.PutUint16(p.ipHdr.Buffer[ipv4ChecksumPos:ipv4ChecksumPos+2], p.ipHdr.ipChecksum)
}
500264
func AddChecksums(inputs []Trytes, isAddress bool, checksumLength uint64) ([]Trytes, error) {
	withChecksums := make([]Trytes, len(inputs))
	for i, s := range inputs {
		t, err := AddChecksum(s, isAddress, checksumLength)
		if err != nil {
			return nil, err
		}
		withChecksums[i] = t
	}
	return withChecksums, nil
}
1056824
func (s *PutSlotTypeInput) SetChecksum(v string) *PutSlotTypeInput {
	s.Checksum = &v
	return s
}
850864
func (s *PutBotAliasInput) SetChecksum(v string) *PutBotAliasInput {
	s.Checksum = &v
	return s
}
165142
func (b UDP) CalculateChecksum(partialChecksum uint16, totalLen uint16) uint16 {
	// Add the length portion of the checksum to the pseudo-checksum.
	tmp := make([]byte, 2)
	binary.BigEndian.PutUint16(tmp, totalLen)
	checksum := Checksum(tmp, partialChecksum)

	// Calculate the rest of the checksum.
	return Checksum(b[:UDPMinimumSize], checksum)
}
965812
func checksum(ctx context.Context, filename string, h hash.Hash) (b []byte, err error) {
	var f *os.File
	f, err = os.Open(filename)
	if err != nil {
		return
	}
	defer func() {
		err = f.Close()
	}()

	t := newTransfer(ctx, nil, h, f, nil)
	if _, err = t.copy(); err != nil {
		return
	}

	b = h.Sum(nil)
	return
}
1210185
func checksum(input []byte) (cksum [4]byte) {
	h := sha256.Sum256(input)
	h2 := sha256.Sum256(h[:])
	copy(cksum[:], h2[:4])
	return
}
643243
func checksum(buf []byte) uint16 {
	sum32 := checksumDelta(0, buf)
	sum16 := csumConvert32To16bit(sum32)

	csum := ^sum16
	return csum
}