DiigIT | IT Community
No Profile Image
Welcome Guest
New User? Register | Login

Need help in mcrypt php

By: rekha singh | 09 Mar 2010 5:33 pm

Hiiiii
i want to calculate the time of php for encrypting a file of 10 MB using 3DES method.
I implemented the code successfully.
But unable to calculate the correct time because whenever i execute the page its gives different times in seconds as 10 sec or some time 24 seconds.
Kindly help meeeeee
this is code tested in xamp 1.7.2

<?php
$timestart=time( );

$file = 'textfile.txt' ;
$initial_contents = file_get_contents( $file);

if($initial_ contents) {

$key = "this key";
$encrypted_data = mcrypt_ecb (MCRYPT_3DES, $key, $initial_contents, MCRYPT_ENCRYPT) ;

}

?>
<table width="1120" align="center" bgcolor="#ffffff" border="0" valign="top" cellspacing= "0" cellpadding= "0">
<tr><td>&nbsp; &nbsp;&nbsp; <?php echo time()-$timestart; ?></td></tr> </table>
 

Comments

Clearly other factors are involved, such as startup times or perhaps data transmission times. I would suggest using a loop and to do the encryption multiple times, say 50 or 100, and then the proportional impact of the extraneous times is much less.
 

By: rekha singh | 09 Mar 2010

Leave a comment

Enter the text in the image
img
Can't read?
Type the characters you see in the picture below.


Close Move