Jump to content


Mcrypt Problem

  • Please log in to reply
No replies to this topic

#1 Georgio

  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 17 June 2006 - 05:48 AM

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\" /]

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users