for (i=0; i<key->bytes; i++) {
for (i=key->bytes; i-- ;) {
void rsaencrypt(unsigned char *data, int length, struct RSAKey *key) {    Bignum b1, b2;    int w, i;    unsigned char *p;    debug(key->exponent);    memmove(data+key->bytes-length, data, length);    data[0] = 0;    data[1] = 2;    for (i = 2; i < key->bytes-length-1; i++) {	do {	    data[i] = random_byte();	} while (data[i] == 0);    }    data[key->bytes-length-1] = 0;    w = (key->bytes+1)/2;    b1 = newbn(w);    b2 = newbn(w);    p = data;    for (i=1; i<=w; i++)	b1[i] = 0;    for (i=0; i<key->bytes; i++) {	unsigned char byte = *p++;	if ((key->bytes-i) & 1)	    b1[w-i/2] |= byte;	else	    b1[w-i/2] |= byte<<8;    }    debug(b1);    modpow(b1, key->exponent, key->modulus, b2);    debug(b2);    p = data;    for (i=0; i<key->bytes; i++) {	unsigned char b;	if (i & 1)	    b = b2[w-i/2] & 0xFF;	else	    b = b2[w-i/2] >> 8;	*p++ = b;    }    freebn(b1);    freebn(b2);}