The MCRYPT_TWOFISH constant when defined by mcrypt version 2.4.x and later is the 256 bit version of Twofish; it uses a 1-32 byte key, a 16 byte IV, and outputs 16 byte blocks in CBC mode.
Aqui hay una lista de los cifradores que actualmente son soportados por la extensión mcrypt. Para una lista completa de los cifradores soportados, vea los defines al final de mcrypt.h. La regla general con la API de mcrypt-2.2.x es que se puede acceder al cifrador desde PHP con MCRYPT_ciphername. Con la API de libmcrypt-2.4.x y libmcrypt-2.5.x estas constantes también trabajan, pero es posible especificar el nombre del cifrador como una string al invocar a mcrypt_module_open().
Se debe (en modo CFB
y OFB
)
o se puede (en modo CBC
) suministrar un vector de
inicialización (IV) a la función de cifrado correspondiente. El IV debe
ser único y debe ser el mismo cuando cifra/descifra. Con información
que es almacenada encriptada, se puede tomar la salida de una función
del índice con el que la información es almacenada (por ej., la clave MD5
de un nombre de archivo). Alternativamente, se puede transmitir el IV junto
con los datos encriptados (ver el capítulo 9.3 de Applied Cryptography by Schneier (ISBN 0-471-11709-9)
para una discusión sobre este tema).
The MCRYPT_TWOFISH constant when defined by mcrypt version 2.4.x and later is the 256 bit version of Twofish; it uses a 1-32 byte key, a 16 byte IV, and outputs 16 byte blocks in CBC mode.
These constants can in fact be used as input to the function mcrypt_module_open() because mcrypt.php contains defines that map these constants to the appropriate string values obtained from mcrypt_list_algorithms().
Note, these are not the names you use in the function mcrypt_module_open to specify the algorithm.
Use mcrypt_list_algorithms to get the right names to stick in there
The latest patents for the IDEA algorithm have expired in 2012 and the cipher is now patent-free and free to use.
Interpretability:
mcrypt does not support PKCS#7 padding, it uses non-standard and insecure null padding. This means that for interoperability with most other implementations PKCS#7 padding will have to be added prior to encryption and/or removed after decryption. This is a major source of interoperability issues.
When interoperating with AES the mcrypt algorithm must be specified as MCRYPT_RIJNDAEL_128 since AES only supports a block size of 128-bits. There is often confusion that this specifies the key size which it does not.