Jump to content


This topic is now archived and is closed to further replies.


Mcrypt Problem

Recommended Posts

Hi everyone!

I am new in language programming so your assistance would be highly appreciated. I learning PHP programming and now on a script with the usage of Mcrypt which seems not to be working well. The error message I receive when I run the script is it cannot decode as required and further get the following error:

Warning: mcrypt_generic_init() [function.mcrypt-generic-init]: Iv size incorrect; supplied length: 0, needed: 8 in c:\Inetpub\wwwroot\php\phpadv_scripts\4\Script4_6Admn\see_users.php on line 25

1George $1$9J..cg2.$F8Ob4lssAWBzq2xViPDr31 pTzSswVo/NZhfZq1asYfQC8P0lefe91/TBWrFZ93nXyes+eggjqzS+RNxt1zyqBY 5Fl6lc4xjwA=

Here is the script:

<?php # Script 4.6

if ($file_array = @file ("../../users.txt")) { // Read the file into an array.

// **** Mcrypt *****

// Create a key.
$key = "Hey! Here's the KEY.1776";

// Open and initialize Mcrypt.
$module = mcrypt_module_open (tripledes, '', ecb, '');

foreach ($file_array as $key => $value) { // Loop through each line.

$line = explode ("\t", $value);
// Decrypt the data.
$iv = base64_decode(trim($line[3]));
mcrypt_generic_init ($module, $key, $iv);
$data = mdecrypt_generic ($module, base64_decode($line[2]));

echo "<pre>$line[0] $line[1] $data</pre><p></p>\n"; // Print the data.


// Close Mcrypt.
mcrypt_generic_deinit ($module);

} else { // If it couldn't read the file, print an error message.
echo "Could not read the users file!<br />";

What could be the cause for the error?

I am using the following on my system:
Windows XP - Home Edition
PHP 5.1.2.
MySQL 5.0.19-nt

Thanks for any help that solve this problem for me.

here2learn [img src=\"style_emoticons/[#EMO_DIR#]/unsure.gif\" style=\"vertical-align:middle\" emoid=\":unsure:\" border=\"0\" alt=\"unsure.gif\" /]

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.