s->shortkey = (keylength<=80);
/* littel endian only! */
memset(&(x[0]), 0 ,16); /* set x to zero */
- memcpy(&(x[0]), key, keylength/8);
+ if(keylength > 128)
+ keylength=128;
+ memcpy(&(x[0]), key, (keylength+7)/8);
/* todo: merge a and b and compress the whole stuff */
return (((ia - ib) + ic) ^ id);
#else
- return (((pgm_read_dword(&s1[((uint8_t*)&t)[IA]] ) - pgm_read_dword(&s2[((uint8_t*)&t)[IB]] ))
- + pgm_read_dword(&s3[((uint8_t*)&t)[IC]] )) ^ pgm_read_dword(&s4[((uint8_t*)&t)[ID]]));
+ return (((pgm_read_dword(&s1[((uint8_t*)&t)[IA]])
+ - pgm_read_dword(&s2[((uint8_t*)&t)[IB]]) )
+ + pgm_read_dword(&s3[((uint8_t*)&t)[IC]]) )
+ ^ pgm_read_dword(&s4[((uint8_t*)&t)[ID]]) );
#endif
}