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().
以下に、mcrypt 拡張モジュールにより現在サポートされている暗号のリストを 示します。サポートされる暗号の完全なリストについては、 mcrypt.h の最後にある define を参照ください。 mcrypt-2.2.x API に関する一般的な規則は、 MCRYPT_暗号名で PHP から暗号をアクセス可能であるということです。 mcrypt-2.4.x および mcrypt-2.5.x の API についてもこれらの定数は 使用できますが、mcrypt_module_open() を コールする際に文字列で暗号名を指定することも可能です。
(CFB
および OFB
モードでは)それぞれの暗号関数に初期化ベクトル(IV)
を指定する必要があり、(CBC
モードでは)IV を指定することが可能です。
IV はユニークである必要があり、暗号化/復号化の際に同じである
必要があります。暗号化されて保存されたデータの場合、関数の出力を
(ファイル名の MD5 キーのように) 保存されたデータの位置を表す
インデックスとして使用することができます。もしくは、暗号化された
データと共に IV を渡すことができます(このトピックに関する議論については、
Applied Cryptography by Schneier (ISBN 0-471-11709-9) の 9.3 章を参照ください)。
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().
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.
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
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.
The latest patents for the IDEA algorithm have expired in 2012 and the cipher is now patent-free and free to use.