( ) - 6


pgamma = gamma+(buflen<<1)+buflen;

for(int i = buflen-1; i >= 0; i--) {

buf[i] += prev;

prev = crc32(prev, buf+i, 1);

prev = crc32(prev, pgamma+i, 1); //

}

}

void decrypt(unsigned char * buf, unsigned buflen, unsigned char * gamma)

{

unsigned prev, next;

unsigned char * pgamma;

// 4 -

prev = 0xffffffff;

pgamma = gamma+(buflen<<1)+buflen;

for(int i = buflen-1; i >= 0; i--) {

next = crc32(prev, buf+i, 1);

next = crc32(next, pgamma+i, 1); //

buf[i] -= prev;

prev = next;

}

// 3 -

prev = 0xffffffff;

pgamma = gamma+(buflen<<1);

for(int i = 0; i < buflen; i++) {

next = crc32(prev, buf+i, 1);

next = crc32(next, pgamma+i, 1); //

buf[i] -= prev;

prev = next;

}

// 2 -

prev = 0xffffffff;

pgamma = gamma+buflen;

for(int i = buflen-1; i >= 0; i--) {

buf[i] -= prev;

prev = crc32(prev, buf+i, 1);

prev = crc32(prev, pgamma+i, 1); //

}

// 1 -

prev = 0xffffffff;

pgamma = gamma;

for(int i = 0; i < buflen; i++) {

buf[i] -= prev;

prev = crc32(prev, buf+i, 1);