精易论坛

标题: 求把一段php加密转换成易语言代码 [打印本页]

作者: 白眼    时间: 2017-8-24 16:46
标题: 求把一段php加密转换成易语言代码
求高人把一下php加密方法转化为易语言代码,php是post输入key和param两个参数  key是加密密码,param是加密文本

  1. <blockquote><?php
复制代码




作者: 小李哥v5    时间: 2017-8-24 16:52



what?

作者: 白眼    时间: 2017-8-24 16:54
  1. <?php
  2. if(isset($_POST['param']) and isset($_POST['key'])) {
  3.     $aesUtil = new AESUtil();
  4.     $body = $aesUtil->encode(trim($_POST['param']), ($_POST['key']));
  5.     echo $body;exit;
  6. }

  7. class AESUtil {

  8.     protected $mode = 'aes-128-ecb';

  9.     public function encode($param, $skey) {
  10.         $skey = strtolower($skey);
  11.         $content = $param;
  12.         $result = openssl_encrypt($content, $this->mode, hex2bin($skey), true);
  13.         return strtoupper(bin2hex($result));
  14.     }

  15.     public function decode($param, $skey) {
  16.         $skey = strtolower($skey);
  17.         $content = hex2bin($param);
  18.         $result = openssl_decrypt($content, $this->mode, hex2bin($skey), true);
  19.         return $result;
  20.     }
  21. }
复制代码

作者: 白眼    时间: 2017-8-24 16:54
&#14379;孬嫑夯芘 发表于 2017-8-24 16:52
what?
  1. <?php
  2. if(isset($_POST['param']) and isset($_POST['key'])) {
  3.     $aesUtil = new AESUtil();
  4.     $body = $aesUtil->encode(trim($_POST['param']), ($_POST['key']));
  5.     echo $body;exit;
  6. }

  7. class AESUtil {

  8.     protected $mode = 'aes-128-ecb';

  9.     public function encode($param, $skey) {
  10.         $skey = strtolower($skey);
  11.         $content = $param;
  12.         $result = openssl_encrypt($content, $this->mode, hex2bin($skey), true);
  13.         return strtoupper(bin2hex($result));
  14.     }

  15.     public function decode($param, $skey) {
  16.         $skey = strtolower($skey);
  17.         $content = hex2bin($param);
  18.         $result = openssl_decrypt($content, $this->mode, hex2bin($skey), true);
  19.         return $result;
  20.     }
  21. }
复制代码

作者: 冯古屋    时间: 2017-8-24 16:57
就是aes加密撒,网上找个在线加密的,测试下看看那种结果呗
作者: 白眼    时间: 2017-8-24 16:57
冯古屋 发表于 2017-8-24 16:57
就是aes加密撒,网上找个在线加密的,测试下看看那种结果呗

我测试了,不行的
作者: 白眼    时间: 2017-8-24 16:58
当  key=abc    param = 123 时  加密结果为 952DD4996CF4E28D316FB6657FF406B8
作者: 唯你入我心    时间: 2017-8-24 17:18
qq82794934
作者: 猥琐小胖子    时间: 2017-8-24 17:46
https://125.confly.eu.org/forum.php?mod=viewthread&tid=14001521




欢迎光临 精易论坛 (https://125.confly.eu.org/) Powered by Discuz! X3.4