Jump to content

mcrypt


dp2

Recommended Posts

I am trying to read a flat file and echo each line. The data also contains encrypted passwords which I wish to decyfer. But my script is displaying the following warning:

 

Warning: mcrypt_generic_init(): Iv size incorrect; supplied length: 4, needed: 8 in /home/aynsley/public_html/1pw/see_users.php on line 25

dp2 $1$qrBh7zJ8$x5VTTg8qmb1EW7hiXxP9J1 8ϊ
‚

 

The script

 

<?php 

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

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

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

// Open and initialize Mcrypt.
$mcrypt_module = mcrypt_module_open (MCRYPT_TripleDES, "", MCRYPT_MODE_CBC, "");

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

	$line = explode ("\t", $value);
	// Decrypt the data.
	[color=red]$mcrypt_iv = base64_decode (trim($line[3]));
	mcrypt_generic_init ($mcrypt_module, $mcrypt_key, $mcrypt_iv);[/color]
	$data = mdecrypt_generic ($mcrypt_module, base64_decode($line[2]));

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

}

// Close Mcrypt.
mcrypt_generic_end ($mcrypt_module);

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

 

How do I increase the IV size?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.