djmartins Posted March 15, 2011 Report Share Posted March 15, 2011 Labdien man ir jautājums, kā var iegūt šifrēšanas un atšifrēšanas laikus? Es vēlētos salīdzināt, kurš šifrēšanas algoritms ir ātrāks. <?php $key = "Labi, ka ir ta"; $input = "Ziema iet un aiziet"; $encrypted_data = mcrypt_ecb (MCRYPT_3DES, $key, $input, MCRYPT_ENCRYPT); $result = mcrypt_ecb (MCRYPT_3DES, $key, $encrypted_data, MCRYPT_DECRYPT); $encrypted_data2 = mcrypt_ecb (MCRYPT_AES, $key, $input, MCRYPT_ENCRYPT); $result2 = mcrypt_ecb (MCRYPT_AES, $key, $encrypted_data2, MCRYPT_DECRYPT); echo"$encrypted_data"; echo"<br>"; echo"$result"; ?> Quote Link to comment Share on other sites More sharing options...
rATRIJS Posted March 15, 2011 Report Share Posted March 15, 2011 $start = microtime(true); do_stuff_like_encryption_n_things(); echo microtime(true) - $start; Quote Link to comment Share on other sites More sharing options...
daGrevis Posted March 16, 2011 Report Share Posted March 16, 2011 Tik izdarot darbību vienu reizi... laika intervāls būs pārāk mazs, lai vispār uzrādītos... for( $i = 0; $i < 10000; $i++ ) { // Magic! } Quote Link to comment Share on other sites More sharing options...
djmartins Posted March 25, 2011 Author Report Share Posted March 25, 2011 (edited) Laiks tiek parādīts sekundēs vai mikrosekundēs? Edited March 25, 2011 by djmartins Quote Link to comment Share on other sites More sharing options...
briedis Posted March 25, 2011 Report Share Posted March 25, 2011 Laiks tiek parādīts sekundēs vai milisekundēs? RTFM - read the fine manual :) Quote Link to comment Share on other sites More sharing options...
djmartins Posted March 25, 2011 Author Report Share Posted March 25, 2011 RTFM - read the fine manual :) Paldies par palīdzību! Quote Link to comment Share on other sites More sharing options...
briedis Posted March 25, 2011 Report Share Posted March 25, 2011 Nav problēmu, vienmēr laipni! :) Quote Link to comment Share on other sites More sharing options...
djmartins Posted March 25, 2011 Author Report Share Posted March 25, 2011 echo (microtime(1) - $time) * 1000000; Ar matemātiku es esmu uz Jūs. Vai šādā veidā tiek iegūts rezultāts sekundēs? 1 mikrosekunde = 10 pakāpē -6 Quote Link to comment Share on other sites More sharing options...
daGrevis Posted March 25, 2011 Report Share Posted March 25, 2011 $seconds = round( $milliseconds / 1000 ); Quote Link to comment Share on other sites More sharing options...
rATRIJS Posted March 25, 2011 Report Share Posted March 25, 2011 Ja tev vajag sekundes izmanto time(); Quote Link to comment Share on other sites More sharing options...
djmartins Posted March 25, 2011 Author Report Share Posted March 25, 2011 Kad iegūst rezultātu un refrešo lapu, tad rādās atkal cits rezultāts kādēļ tā, ja tiek lietos viens un tas pats vienvirzienu šifrēšanas algoritms? Quote Link to comment Share on other sites More sharing options...
rATRIJS Posted March 25, 2011 Report Share Posted March 25, 2011 Sekundees vai milisekundees? Un kaadeelj lai tas taa nevareetu buut? Tak noslogojums nav statisks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.