FIXED:
* Missed a Reset on the inetcksum.InetChecksumSimple.
This commit is contained in:
brent saner
2025-09-05 18:55:01 -04:00
parent 970acd0ee4
commit 965657d1b2
2 changed files with 28 additions and 3 deletions

View File

@@ -22,6 +22,15 @@ func (i *InetChecksumSimple) BlockSize() (blockSize int) {
return
}
// Reset resets the state of an InetChecksumSimple.
func (i *InetChecksumSimple) Reset() {
i.last = 0x00
i.sum = 0
i.last = 0x00
}
// Size returns how many bytes a checksum is. (It will always return 2.)
func (i *InetChecksumSimple) Size() (bufSize int) {
@@ -151,3 +160,13 @@ func (i *InetChecksumSimple) WriteByte(c byte) (err error) {
return
}
// WriteString checksums a string. It conforms to [io.StringWriter].
func (i *InetChecksumSimple) WriteString(s string) (n int, err error) {
if n, err = i.Write([]byte(s)); err != nil {
return
}
return
}