view src/lib-otp/otp-parity.h @ 9445:d7f8dbc38fd7 HEAD

imap: If client disconnects while appending, don't treat the rest of the message as commands.
author Timo Sirainen <tss@iki.fi>
date Tue, 20 Oct 2009 13:21:13 -0400
parents 62cf70991cf2
children
line wrap: on
line source

#ifndef OTP_PARITY_H
#define OTP_PARITY_H

extern const unsigned char parity_table[256];

static inline unsigned int otp_parity(unsigned char *data)
{
	unsigned int i, parity = 0;

	for (i = 0; i < OTP_HASH_SIZE; i++)
		parity += parity_table[*data++];

	return parity & 3;
}

#endif