Q: Error during encrypt a file using Mcrypt DES in php i want to encrypt a text file. below is my code.But i am getting function error during run.
<?php

 $key = '123456';
 $plain_text = pkcs5_pad(file_get_contents('yourFile.txt'));

 /* Open module, and create IV */
 $td = mcrypt_module_open(MCRYPT_DES, '', MCRYPT_MODE_CBC, '');
 $key = substr($key, 0, mcrypt_enc_get_key_size($td));
 $iv_size = mcrypt_enc_get_iv_size($td);
 $iv = mcrypt_create_iv($iv_size, MCRYPT_DEV_URANDOM);

 /* Initialize encryption handle */
 mcrypt_generic_init($td, $key, $iv);

/* Encrypt data */
$encrypted = mcrypt_generic($td, $plain_text);
mcrypt_generic_deinit($td);
file_put_contents('yourFile.txt.enc', $encrypted);
?>

i am getting below error..please help me to solve this.
Fatal error: Call to undefined function pkcs5_pad() in C:\xampp\htdocs\data\encrypt.php on line 4


A: You need to make sure that you have the mcrypt module installed, configured, and enabled before you can use the pkcs5_pad function.  Installation and configuration will be different depending on your platform, so please see the documentation for assistance.
