3v4l.org

run code in 300+ PHP versions simultaneously
<?php class NavicatPassword { protected $version = 0; protected $aesKey = 'libcckeylibcckey'; protected $aesIv = 'libcciv libcciv '; protected $blowString = '3DC5CA39'; protected $blowKey = null; protected $blowIv = null; public function __construct($version = 12) { $this->version = $version; $this->blowKey = sha1('3DC5CA39', true); $this->blowIv = hex2bin('d9c7c3c8870d64bd'); } public function encrypt($string) { $result = FALSE; switch ($this->version) { case 11: $result = $this->encryptEleven($string); break; case 12: $result = $this->encryptTwelve($string); break; default: break; } return $result; } protected function encryptEleven($string) { $round = intval(floor(strlen($string) / 8)); $leftLength = strlen($string) % 8; $result = ''; $currentVector = $this->blowIv; for ($i = 0; $i < $round; $i++) { $temp = $this->encryptBlock($this->xorBytes(substr($string, 8 * $i, 8), $currentVector)); $currentVector = $this->xorBytes($currentVector, $temp); $result .= $temp; } if ($leftLength) { $currentVector = $this->encryptBlock($currentVector); $result .= $this->xorBytes(substr($string, 8 * $i, $leftLength), $currentVector); } return strtoupper(bin2hex($result)); } protected function encryptBlock($block) { return openssl_encrypt($block, 'BF-ECB', $this->blowKey, OPENSSL_RAW_DATA|OPENSSL_NO_PADDING); } protected function decryptBlock($block) { return openssl_decrypt($block, 'BF-ECB', $this->blowKey, OPENSSL_RAW_DATA|OPENSSL_NO_PADDING); } protected function xorBytes($str1, $str2) { $result = ''; for ($i = 0; $i < strlen($str1); $i++) { $result .= chr(ord($str1[$i]) ^ ord($str2[$i])); } return $result; } protected function encryptTwelve($string) { $result = openssl_encrypt($string, 'AES-128-CBC', $this->aesKey, OPENSSL_RAW_DATA, $this->aesIv); return strtoupper(bin2hex($result)); } public function decrypt($string) { $result = FALSE; switch ($this->version) { case 11: $result = $this->decryptEleven($string); break; case 12: $result = $this->decryptTwelve($string); break; default: break; } return $result; } protected function decryptEleven($upperString) { $string = hex2bin(strtolower($upperString)); $round = intval(floor(strlen($string) / 8)); $leftLength = strlen($string) % 8; $result = ''; $currentVector = $this->blowIv; for ($i = 0; $i < $round; $i++) { $encryptedBlock = substr($string, 8 * $i, 8); $temp = $this->xorBytes($this->decryptBlock($encryptedBlock), $currentVector); $currentVector = $this->xorBytes($currentVector, $encryptedBlock); $result .= $temp; } if ($leftLength) { $currentVector = $this->encryptBlock($currentVector); $result .= $this->xorBytes(substr($string, 8 * $i, $leftLength), $currentVector); } return $result; } protected function decryptTwelve($upperString) { $string = hex2bin(strtolower($upperString)); return openssl_decrypt($string, 'AES-128-CBC', $this->aesKey, OPENSSL_RAW_DATA, $this->aesIv); } }; //需要指定navacat版本两种,11或12 $navicatPassword = new NavicatPassword(12); //解密,括号里面写入navicat加密后的密码 $decode = $navicatPassword->decrypt('4137021BF94FD1A8E352B5F967A370A2'); echo $decode."\n"; ?>

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.4.20.0340.01517.81
8.4.10.0340.01317.73
8.3.160.0090.00916.72
8.3.150.0330.01016.56
8.3.140.0360.01116.66
8.3.130.0350.00716.45
8.3.120.0360.00816.77
8.3.110.0290.01316.66
8.3.100.0460.00916.66
8.3.90.0380.00816.73
8.3.80.0400.00316.71
8.3.70.0240.00916.72
8.3.60.0310.00216.68
8.3.50.0250.01016.74
8.3.40.0340.00817.59
8.3.30.0320.00817.53
8.3.20.0310.00717.55
8.3.10.0310.00517.58
8.3.00.0150.00617.78
8.2.270.0210.00916.54
8.2.260.0260.00816.45
8.2.250.0290.00916.51
8.2.240.0280.01016.55
8.2.230.0300.00916.41
8.2.220.0290.00916.55
8.2.210.0290.01016.62
8.2.200.0310.00916.57
8.2.190.0260.01316.34
8.2.180.0280.01216.63
8.2.170.0320.00917.65
8.2.160.0290.00517.77
8.2.150.0250.00817.39
8.2.140.0350.00717.47
8.2.130.0360.00517.54
8.2.120.0270.01417.50
8.2.110.0360.00717.47
8.2.100.0300.01017.46
8.2.90.0360.00617.59
8.2.80.0310.00817.47
8.2.70.0330.00817.46
8.2.60.0240.00817.48
8.2.50.0280.01217.30
8.2.40.0260.00917.39
8.2.30.0290.01017.42
8.2.20.0330.00817.41
8.2.10.0300.00517.40
8.2.00.0280.00917.40

preferences:
18.78 ms | 403 KiB | 5 Q