Re: [PHP] Optimize simple file XOR code

2004-06-24 Thread Curt Zirzow
* Thus wrote Marcus Johansson: > Wow! That REALLY did make a great difference! > Encoding a file of 2MB took 50 seconds before, now it is done in 1 (ONE) > second! > > My Key is 8192 bytes long, is that the reason for why it so much faster > for me? Most likely because the number crunching is hap

Re: [PHP] Optimize simple file XOR code

2004-06-24 Thread Curt Zirzow
Just to speed things up a little more... * Thus wrote Marcel Tschopp: > ... > $key = GenerateKey($hash); > $keylen = strlen($key = implode('', $key)); > > $handle = fopen($filename, 'r'); > while (!feof($handle)) > { > // Set the time limit or the script will time out >

RE: [PHP] Optimize simple file XOR code

2004-06-24 Thread Marcus Johansson
much! -- Marcus -Original Message- From: Marcel Tschopp [mailto:[EMAIL PROTECTED] Sent: den 24 juni 2004 13:37 To: [EMAIL PROTECTED] Subject: Re: [PHP] Optimize simple file XOR code Hi Marcus Try this: function CryptFile($hash, $filename) { // The key used is generated using an

Re: [PHP] Optimize simple file XOR code

2004-06-24 Thread Marcel Tschopp
Hi Marcus Try this: function CryptFile($hash, $filename) { // The key used is generated using another function. // Since this function is only called once it has // nothing to do with the performance of this function $key = GenerateKey($hash); $keylen = strlen($key = implode('