Created: Feb 21, 2002
Updated: Oct 17, 2002
SVN Updated: Mar 10, 2009
Other project properties
Development status: Beta
WishBone Compliant: No
Twofish is a 128-bit block cipher that can accept variable key length 128,192 and 256 bit. In this project we just use key length
128 bit. Twofish is fundamental built by F-function, rotate-left one bit, rotate-right one bit, and XOR.The cipher has 16 round F-function . F-function is made up by four key-dependent 8-by-8-bit S-box, a fixed 4-by-4 maximum distance separable matrix over GF(2^8), a pseudo-Hadamard transform, bitwise rotation, and key scedule.
As can be seen from figure 1, input will be latched first into a register and then separated into four word. The four word then XOR with K0,K1,K2,K3. This step is called input-whitening. Data then goes through F-function. On F-function, there are various rotation, transformation and permutation are applied to it. F-function is made of two h-functions containing key-dependant S-boxes and Maximum Distance Separable Matrix (MDS) , Pseudo-Hadamard Transform (PHT). After going 16 time through this function, the four word of data are one again XOR-ed with four sub-key K4,K5,K6,K7. This step is called output whitening. Finally encrypted or decrypted data is latched into output register.
DESCRIPTION: Figure 1. Structure of Twofish block Cipher
DESCRIPTION: Input register module
DESCRIPTION: Output register module
DESCRIPTION: Key-register module
DESCRIPTION: Modified-F module
1. Twofish can accept key-length 128, 192, 256 bit. In this project we used 128 bit key-length
2. Use little-endian convention for input, output and key
We have finished designing Twofish core using VHDL, and the test result is OK.