1
littleylv 2021-08-11 14:27:09 +08:00
/**
* decrypt * * @param string $input string to decrypted * @return string string decrypted */ public function decrypt($input) { $decrypted = openssl_decrypt(base64_decode($input), 'AES-128-CBC', $this->key, OPENSSL_RAW_DATA, $this->hexToStr($this->hex_iv)); return $decrypted; } /** * hexToStr * * @param string $hex hex * @return string string */ private function hexToStr($hex) { $string = ''; $len = strlen($hex); for ($i = 0; $i < $len - 1; $i += 2) { $string .= chr(hexdec($hex[$i] . $hex[$i + 1])); } return $string; } |
2
UnrealEngine OP @littleylv 不行,哦忘了那个方法加密前还有另一个处理函数,
字符串:FHPdyFl63G6xl/2rge/VQDkCW79tNG4cAFlnulZHj2shQ1+m1GeY++7MdTX/+KD9/13vDremaHrSMRlg1Wd/HA== KEY:1805412879961850 public static string AESDecrypt(string cipherText, string key) { var iv = string.Join("", key.ToCharArray().Reverse()); return AESDecrypt(cipherText, key, iv); } |
3
littleylv 2021-08-11 15:36:37 +08:00
你是一点都不懂 C#还是一点都不懂 PHP 还是都不懂
我都方法告诉你了,就算你前面有个处理函数,不就是把 key 反转成 iv 吗 $input = base64_decode('FHPdyFl63G6xl/2rge/VQDkCW79tNG4cAFlnulZHj2shQ1+m1GeY++7 MdTX/+KD9/13vDremaHrSMRlg1Wd/HA=='); $key = '1805412879961850'; $iv = strrev($key); $decrypted = openssl_decrypt($input, 'AES-128-CBC', $key, OPENSSL_RAW_DATA, $iv); var_dump($decrypted); // 打印结果:string(49) "{"ActionId":1000,"SourceName":"YF37ZTOVEN6NRZO3"}" |