[Koha-patches] [PATCH] Bug 4828: Clean diacritics from SIP-written messages

Colin Campbell colin.campbell at ptfs-europe.com
Fri Feb 18 15:16:47 CET 2011


On 18/02/11 11:28, Ian Walls wrote:

> Unfortunately, I have no idea what the corrected checksum calculation should
> look like... scouring the web now...

My hunch is that the problem is the pack/unpack in Sip/Checksum which
uses Unicode _character_ semantics. It should probably use bytes.
Here's the calculation from the developers guide:

> char * compute_checksum (char * message)
> {
> static char ascii_checksum[5];
> unsigned int checksum = 0;
> int i = 0;
> while (message[i] != ‘\0’)
> {
> checksum += (unsigned) message[i];
> i++;
> }
> checksum = -(checksum & 0xFFFF);
> sprintf (ascii_checksum, “%4.4X”, checksum);
> return (ascii_checksum);
> }

If someone has an example that we know calculates wrong we can set up a test

Cheers
Colin

-- 
Colin Campbell
Chief Software Engineer,
PTFS Europe Limited
Content Management and Library Solutions
+44 (0) 845 557 5634 (phone)
+44 (0) 7759 633626  (mobile)
colin.campbell at ptfs-europe.com
skype: colin_campbell2

http://www.ptfs-europe.com


More information about the Koha-patches mailing list