Home | History | Annotate | Download | only in twofish

Lines Matching refs:twofish

13    @file twofish.c
14 Implementation of Twofish by Tom St Denis
18 #ifdef TWOFISH
29 "twofish",
280 #define S1 skey->twofish.S[0]
281 #define S2 skey->twofish.S[1]
282 #define S3 skey->twofish.S[2]
283 #define S4 skey->twofish.S[3]
303 z = key->twofish.start;
313 g = g ^ key->twofish.S[4*i++ + y];
338 Initialize the Twofish block cipher
385 rs_mult(M+(x*8), skey->twofish.S+(x*4));
407 skey->twofish.K[x+x] = (A + B) & 0xFFFFFFFFUL;
410 skey->twofish.K[x+x+1] = ROLc(B + B + A, 9);
419 skey->twofish.S[0][x] = mds_column_mult(sbox(1, (sbox(0, tmpx0 ^ S[0]) ^ S[4])),0);
420 skey->twofish.S[1][x] = mds_column_mult(sbox(0, (sbox(0, tmpx1 ^ S[1]) ^ S[5])),1);
421 skey->twofish.S[2][x] = mds_column_mult(sbox(1, (sbox(1, tmpx0 ^ S[2]) ^ S[6])),2);
422 skey->twofish.S[3][x] = mds_column_mult(sbox(0, (sbox(1, tmpx1 ^ S[3]) ^ S[7])),3);
428 skey->twofish.S[0][x] = mds_column_mult(sbox(1, (sbox(0, sbox(0, tmpx1 ^ S[0]) ^ S[4]) ^ S[8])),0);
429 skey->twofish.S[1][x] = mds_column_mult(sbox(0, (sbox(0, sbox(1, tmpx1 ^ S[1]) ^ S[5]) ^ S[9])),1);
430 skey->twofish.S[2][x] = mds_column_mult(sbox(1, (sbox(1, sbox(0, tmpx0 ^ S[2]) ^ S[6]) ^ S[10])),2);
431 skey->twofish.S[3][x] = mds_column_mult(sbox(0, (sbox(1, sbox(1, tmpx0 ^ S[3]) ^ S[7]) ^ S[11])),3);
437 skey->twofish.S[0][x] = mds_column_mult(sbox(1, (sbox(0, sbox(0, sbox(1, tmpx1 ^ S[0]) ^ S[4]) ^ S[8]) ^ S[12])),0);
438 skey->twofish.S[1][x] = mds_column_mult(sbox(0, (sbox(0, sbox(1, sbox(1, tmpx0 ^ S[1]) ^ S[5]) ^ S[9]) ^ S[13])),1);
439 skey->twofish.S[2][x] = mds_column_mult(sbox(1, (sbox(1, sbox(0, sbox(0, tmpx0 ^ S[2]) ^ S[6]) ^ S[10]) ^ S[14])),2);
440 skey->twofish.S[3][x] = mds_column_mult(sbox(0, (sbox(1, sbox(1, sbox(0, tmpx1 ^ S[3]) ^ S[7]) ^ S[11]) ^ S[15])),3);
447 case 4 : skey->twofish.start = 0; break;
448 case 3 : skey->twofish.start = 1; break;
449 default: skey->twofish.start = 2; break;
466 Encrypts a block of text with Twofish
489 S1 = skey->twofish.S[0];
490 S2 = skey->twofish.S[1];
491 S3 = skey->twofish.S[2];
492 S4 = skey->twofish.S[3];
497 a ^= skey->twofish.K[0];
498 b ^= skey->twofish.K[1];
499 c ^= skey->twofish.K[2];
500 d ^= skey->twofish.K[3];
502 k = skey->twofish.K + 8;
517 ta = c ^ skey->twofish.K[4];
518 tb = d ^ skey->twofish.K[5];
519 tc = a ^ skey->twofish.K[6];
520 td = b ^ skey->twofish.K[7];
539 Decrypts a block of text with Twofish
562 S1 = skey->twofish.S[0];
563 S2 = skey->twofish.S[1];
564 S3 = skey->twofish.S[2];
565 twofish.S[3];
573 a = tc ^ skey->twofish.K[6];
574 b = td ^ skey->twofish.K[7];
575 c = ta ^ skey->twofish.K[4];
576 d = tb ^ skey->twofish.K[5];
578 k = skey->twofish.K + 36;
593 a ^= skey->twofish.K[0];
594 b ^= skey->twofish.K[1];
595 c ^= skey->twofish.K[2];
596 d ^= skey->twofish.K[3];
614 Performs a self-test of the Twofish block cipher
668 printf("Twofish failed test %d, %d, %d\n", i, XMEMCMP(tmp[0], tests[i].ct, 16), XMEMCMP(tmp[1], tests[i].pt, 16));
716 /* $Source: /cvs/libtom/libtomcrypt/src/ciphers/twofish/twofish.c,v $ */