note 126487 deleted from function.openssl-encrypt by cmb

From: Date: Fri, 08 Oct 2021 12:20:06 +0000
Subject: note 126487 deleted from function.openssl-encrypt by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-217045@lists.php.net to get a copy of this message
Note Submitter: synnus at gmail dot com ---- <?php /* test speed encrypt metho */ $method = ['aes-128-cbc', 'aes-128-cbc-hmac-sha1', 'aes-128-cbc-hmac-sha256', 'aes-128-ccm', 'aes-128-cfb', 'aes-128-cfb1', 'aes-128-cfb8', 'aes-128-ctr', 'aes-128-gcm', 'aes-128-ocb', 'aes-128-ofb', 'aes-128-xts', 'aes-192-cbc', 'aes-192-ccm', 'aes-192-cfb', 'aes-192-cfb1', 'aes-192-cfb8', 'aes-192-ctr', 'aes-192-gcm', 'aes-192-ocb', 'aes-192-ofb', 'aes-256-cbc', 'aes-256-cbc-hmac-sha1', 'aes-256-cbc-hmac-sha256', 'aes-256-ccm', 'aes-256-cfb', 'aes-256-cfb1', 'aes-256-cfb8', 'aes-256-ctr', 'aes-256-gcm', 'aes-256-ocb', 'aes-256-ofb', 'aes-256-xts', 'aria-128-cbc', 'aria-128-ccm', 'aria-128-cfb', 'aria-128-cfb1', 'aria-128-cfb8', 'aria-128-ctr', 'aria-128-gcm', 'aria-128-ofb', 'aria-192-cbc', 'aria-192-ccm', 'aria-192-cfb', 'aria-192-cfb1', 'aria-192-cfb8', 'aria-192-ctr', 'aria-192-gcm', 'aria-192-ofb', 'aria-256-cbc', 'aria-256-ccm', 'aria-256-cfb', 'aria-256-cfb1', 'aria-256-cfb8', 'aria-256-ctr', 'aria-256-gcm', 'aria-256-ofb', 'bf-cbc', 'bf-cfb', 'bf-ofb', 'camellia-128-cbc', 'c amellia-128-cfb', 'camellia-128-cfb1', 'camellia-128-cfb8', 'camellia-128-ctr', 'camellia-128-ofb', 'camellia-192-cbc', 'camellia-192-cfb', 'camellia-192-cfb1', 'camellia-192-cfb8', 'camellia-192-ctr', 'camellia-192-ofb', 'camellia-256-cbc', 'camellia-256-cfb', 'camellia-256-cfb1', 'camellia-256-cfb8', 'camellia-256-ctr', 'camellia-256-ofb', 'cast5-cbc', 'cast5-cfb', 'cast5-ofb', 'chacha20', 'chacha20-poly1305', 'id-aes128-CCM', 'id-aes128-GCM', 'id-aes128-wrap', 'id-aes128-wrap-pad', 'id-aes192-CCM', 'id-aes192-GCM', 'id-aes192-wrap', 'id-aes192-wrap-pad', 'id-aes256-CCM', 'id-aes256-GCM', 'id-aes256-wrap', 'id-aes256-wrap-pad', 'idea-cbc', 'idea-cfb', 'idea-ofb', 'seed-cbc', 'seed-cfb', 'seed-ofb', 'sm4-cbc', 'sm4-cfb', 'sm4-ctr', 'sm4-ofb']; $data = <<<END zayeihfihdfhsdljfsdjfjdpmqsdjkfmùsdkfmskmfùbgsvopkqksmdùlfk smdlfkmlskdfmlqskdfmlskfgbpogikfpsiokgpsodkfpsdlokfmsldkfms dsmflkqmsdkfmsdkfùmsfs^pize^qsdùmlkqf^pze^rp^lfsmlfmùsldùfd dskfmùlsdkfùmlskfmùsldkfùmslkfmùskfmslfoshyvobazeazeazemùae END; $tableau = array(); foreach ($method as $valeur) { $time_start = microtime(true); $ivlen = openssl_cipher_iv_length($valeur); $iv = openssl_random_pseudo_bytes($ivlen); openssl_encrypt($data , $valeur, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', $options = 0, $iv, $tag); $time_end = microtime(true); $time = ($time_end - $time_start) * 1000000000; //echo $valeur, ' => ', $time, PHP_EOL; $tableau[$time][] = $valeur; } ksort($tableau); var_dump($tableau); /* winner speed in PHP 8 : 80010 array(34) { [953]=> array(9) { [0]=> string(11) "aes-128-ofb" [1]=> string(11) "aes-192-cfb" [2]=> string(11) "aes-256-ctr" [3]=> string(11) "aes-256-ofb" [4]=> string(18) "id-aes128-wrap-pad" [5]=> string(18) "id-aes192-wrap-pad" [6]=> string(13) "id-aes256-CCM" [7]=> string(13) "id-aes256-GCM" [8]=> string(18) "id-aes256-wrap-pad" } [1192]=> array(1) { [0]=> string(14) "id-aes192-wrap" } ... ... */

« previous php.notes (#217045) next »