Does anyone know the difference between mcrypt_generic and mcrypt_encrypt when it comes to encryption in PHP?
Does anyone know the difference between mcrypt_generic and mcrypt_encrypt when it comes to encryption
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
mcrypt_encrypt()combines the functionality of several methods, whereasmcrypt_generic()must be called within a certain sequence of othermcrypt_*calls. You would usemcrypt_generic()if you needed the flexibility of the lower-level API, whereasmcrypt_encrypt()acts as a higher-level utility.This example in the PHP documentation shows a good comparison between the two API approaches. It refers to
mcrypt_ecb(), but for the purposes of this comparison you can consider it to be similar tomcrypt_encrypt().From http://us.php.net/manual/en/mcrypt.examples.php
Or: