Rather than returning the integer value of the checksum and converting
that to a hex value only when it is appended to the returned message,
return the hex value from checksum() itself. This enables the unit tests
for Sip::Checksum to be run meaningfully.
Signed-off-by: Dan Scott <dan@coffeecode.net>
sub write_msg {
my ($self, $msg, $file) = @_;
- my $cksum;
if ($error_detection) {
if (defined($self->{seqno})) {
$msg .= 'AY' . $self->{seqno};
}
- $msg .= 'AZ';
- $cksum = checksum($msg);
- $msg .= sprintf('%04.4X', $cksum);
+ $msg .= 'AZ' . checksum($msg);
}
printf STDERR "# %39s\n", $check;
}
- return $check;
+ return sprintf("%4.4X", $check);
}
sub verify_cksum {