3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Emulate OpenFire Blowfish Class */ class OpenFireBlowfish { private $key; private $cipher; public $enckey = "70S28ao84z4wGS7"; //Hidden Encryption Key of Openfire BlowFish public $enciv = ''; function __construct($pass) { $this->cipher = mcrypt_module_open('blowfish','','cbc',''); $ks = mcrypt_enc_get_key_size($this->cipher); $this->key = pack('H*',sha1($pass)); } function encryptString($plaintext, $iv = '') { if ($iv == '') { $iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($this->cipher)); } else { $iv = pack("H*", $iv); } mcrypt_generic_init($this->cipher, $this->key, $iv); $bs = mcrypt_enc_get_block_size($this->cipher); // get block size $plaintext = mb_convert_encoding($plaintext,'UTF-16BE'); // set to 2 byte, network order $pkcs = $bs - (strlen($plaintext) % $bs); // get pkcs5 pad length $pkcs = str_repeat(chr($pkcs), $pkcs); // create padding string $plaintext = $plaintext.$pkcs; // append pkcs5 padding to the data $result = mcrypt_generic($this->cipher, $plaintext); mcrypt_generic_deinit($this->cipher); return $iv.$result; } function decryptString($ciphertext) { $bs = mcrypt_enc_get_block_size($this->cipher); // get block size $iv_size = mcrypt_enc_get_iv_size($this->cipher); if ((strlen($ciphertext) % $bs) != 0) { // check string is proper size exit(1); } $iv = substr($ciphertext, 0, $iv_size); // retrieve IV $ciphertext = substr($ciphertext, $iv_size); mcrypt_generic_init($this->cipher, $this->key, $iv); $result = mdecrypt_generic($this->cipher, $ciphertext); // decrypt //echo var_dump(unpack('c*',$iv))."\n"; $padding = ord(substr($result,-1)); // retrieve padding $result = substr($result,0,$padding * -1); // and remove it mcrypt_generic_deinit($this->cipher); return $result; } function __destruct() { mcrypt_module_close($this->cipher); } } // Test OpenFire Blowfish Class $enckey = "70S28ao84z4wGS7"; //paste your openfire Db passwordKey copied in poin# 3 $enciv = ''; $a = new OpenFireBlowfish($enckey); $encstring = bin2hex($a->encryptString('password',$enciv)); //enter your password string to encrypt it echo "Encrypted Password string:".$encstring . "<br>"; echo "Original Password string:".$a->decryptString(pack("H*", "f84cbd64e079a04c0c9368937702d70251a06e7e86852429cfda6235e391febe")) . "<br>"; ?>

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.3.60.0060.00918.68
8.3.50.0090.01121.25
8.3.40.0070.01518.79
8.3.30.0160.00619.04
8.3.20.0150.00319.99
8.3.10.0060.00322.00
8.3.00.0060.00319.38
8.2.180.0100.00617.00
8.2.170.0120.00622.96
8.2.160.0130.00720.57
8.2.150.0110.00724.18
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0030.00522.05
8.2.110.0100.00019.05
8.2.100.0120.00017.91
8.2.90.0040.00418.09
8.2.80.0080.00018.98
8.2.70.0030.00517.80
8.2.60.0060.00318.04
8.2.50.0080.00518.10
8.2.40.0020.00520.55
8.2.30.0000.00817.89
8.2.20.0000.00817.71
8.2.10.0000.00818.19
8.2.00.0030.00517.79
8.1.280.0070.01125.92
8.1.270.0030.01222.10
8.1.260.0000.01526.35
8.1.250.0040.00428.09
8.1.240.0030.00622.15
8.1.230.0170.00520.67
8.1.220.0030.00617.74
8.1.210.0060.00318.83
8.1.200.0040.00417.23
8.1.190.0040.00417.35
8.1.180.0000.00918.10
8.1.170.0040.00418.59
8.1.160.0000.00722.20
8.1.150.0030.00718.80
8.1.140.0000.00817.47
8.1.130.0000.00717.86
8.1.120.0000.00717.32
8.1.110.0000.00717.44
8.1.100.0070.00017.33
8.1.90.0070.00017.43
8.1.80.0040.00417.38
8.1.70.0000.00817.31
8.1.60.0060.00317.61
8.1.50.0000.00917.55
8.1.40.0000.00817.56
8.1.30.0050.00317.63
8.1.20.0030.00617.63
8.1.10.0050.00317.63
8.1.00.0000.00817.52
8.0.300.0040.00420.08
8.0.290.0060.00316.75
8.0.280.0000.00718.25
8.0.270.0000.00717.98
8.0.260.0000.00717.33
8.0.250.0070.00017.01
8.0.240.0040.00416.98
8.0.230.0040.00416.97
8.0.220.0030.00516.88
8.0.210.0000.00716.85
8.0.200.0030.00616.89
8.0.190.0000.00717.02
8.0.180.0000.00716.95
8.0.170.0040.00416.84
8.0.160.0000.00716.95
8.0.150.0040.00416.90
8.0.140.0040.00416.90
8.0.130.0030.00313.34
8.0.120.0040.00716.86
8.0.110.0040.00416.91
8.0.100.0000.00816.94
8.0.90.0040.00416.95
8.0.80.0030.01316.96
8.0.70.0080.00016.75
8.0.60.0030.00516.98
8.0.50.0040.00416.95
8.0.30.0080.01017.00
8.0.20.0100.01017.47
8.0.10.0040.00416.89
8.0.00.0040.01616.93
7.4.330.0000.00715.00
7.4.320.0040.00416.50
7.4.300.0080.00016.62
7.4.290.0000.00716.53
7.4.280.0000.00716.52
7.4.270.0030.00316.68
7.4.260.0030.00316.65
7.4.250.0000.00716.59
7.4.240.0060.00216.48
7.4.230.0040.00416.62
7.4.220.0080.00916.62
7.4.210.0070.00716.71
7.4.200.0050.00216.46
7.4.160.0060.01016.51
7.4.150.0070.01017.40
7.4.140.0090.01017.86
7.4.130.0090.01016.47
7.4.120.0090.00916.54
7.4.110.0140.00316.45
7.4.100.0070.01016.46
7.4.90.0060.01016.55
7.4.80.0070.01119.39
7.4.70.0070.01016.58
7.4.60.0000.01616.54
7.4.50.0030.00516.55
7.4.40.0000.01716.57
7.4.30.0090.00916.59
7.3.330.0030.00313.22
7.3.320.0000.00513.39
7.3.310.0000.00816.42
7.3.300.0000.00716.39
7.3.290.0000.01316.40
7.3.280.0100.00716.40
7.3.270.0150.00717.40
7.3.260.0110.00616.46
7.3.250.0140.00616.54
7.3.240.0100.00716.39
7.3.230.0170.00616.39
7.3.210.0150.00316.62
7.3.200.0110.01419.39
7.3.190.0150.00916.45
7.3.180.0120.01216.32
7.3.170.0160.00016.54
7.3.160.0120.00316.47
7.2.330.0100.00716.51
7.2.320.0120.00416.43
7.2.310.0030.01716.63
7.2.300.0040.01316.53
7.2.290.0100.01316.66
5.4.450.0230.04019.18
5.4.440.0370.03019.70
5.4.430.0700.04719.62
5.4.420.0630.00019.41
5.4.410.0670.00019.49
5.4.400.0600.00019.32
5.4.390.0630.00019.06
5.4.380.0600.00019.11
5.4.370.0630.00019.06
5.4.360.0630.00019.13
5.4.350.0670.00019.18
5.4.340.0630.00019.14
5.4.320.0050.03812.51
5.4.310.0050.04012.51
5.4.300.0040.04712.51
5.4.290.0050.04312.51
5.4.280.0090.03112.41
5.4.270.0050.03512.41
5.4.260.0090.03512.41
5.4.250.0060.04112.41
5.4.240.0040.04312.41
5.4.230.0080.03712.41
5.4.220.0060.04212.40
5.4.210.0070.04312.40
5.4.200.0070.04012.41
5.4.190.0040.04412.39
5.4.180.0080.03412.40
5.4.170.0060.03512.41
5.4.160.0040.03612.40
5.4.150.0100.03812.40
5.4.140.0040.03812.09
5.4.130.0070.03912.07
5.4.120.0060.04012.03
5.4.110.0070.03312.03
5.4.100.0080.04012.03
5.4.90.0050.04312.03
5.4.80.0040.03812.03
5.4.70.0070.03312.02
5.4.60.0050.03512.02
5.4.50.0070.03412.02
5.4.40.0060.03512.01
5.4.30.0030.03912.01
5.4.20.0080.03712.01
5.4.10.0120.03512.01
5.4.00.0050.03711.50

preferences:
47.09 ms | 401 KiB | 5 Q