void speck_encrypt64(SPECK_TYPE64 const pt[2], SPECK_TYPE64 ct[2], SPECK_TYPE64 const K[SPECK_ROUNDS64]) { SPECK_TYPE64 i; ct[0] = pt[0]; ct[1] = pt[1]; for (i = 0; i < SPECK_ROUNDS64; i++){ R64(ct[1], ct[0], K[i]); } }
void speck_set_decrypt_key64(SPECK_TYPE64 const K[SPECK_KEY_LEN64], SPECK_TYPE64 S[SPECK_ROUNDS64]) { SPECK_TYPE64 i, b = K[0]; SPECK_TYPE64 a[SPECK_KEY_LEN64 - 1]; for (i = 0; i < (SPECK_KEY_LEN64 - 1); i++) { a[i] = K[i + 1]; } S[0] = b; for (i = 0; i < SPECK_ROUNDS64 - 1; i++) { R64(a[i % (SPECK_KEY_LEN64 - 1)], b, i); S[i + 1] = b; } }
// // Io stuff // // MOD Feb 2005 by GMV: prepared for ODML // I placed the extended writing functions here to avoid dupicated code. // But since I am writing data without using Begin or End it may be necessary // or even just more strait to duplicate these functions and implement them // into aviwrite directly void AviList::Write64(uint64_t val){ #ifdef ADM_BIG_ENDIAN val=R64(val); #endif _ff->write((uint8_t *)&val,8); }