如题,需要key value形式的加密,但是不明白实现方法

解决方案 »

  1.   

    最简单的,非可逆加密,用于签名什么的$key = '123456';
    $value = 'test';
    echo md5($value.$key);
      

  2.   

    可以使用这个:http://blog.csdn.net/fdipzone/article/details/8178982?locationNum=1&fps=1
      

  3.   


    <?php 
    require 'aes.class.php';     // AES PHP implementation
    require 'aesctr.class.php';  // AES Counter Mode implementation echo 'each change<br>';$mstr = AesCtr::encrypt('Hello World', 'key', 256);
    echo "Encrypt String : $mstr<br />";$dstr = AesCtr::decrypt($mstr, 'key', 256);
    echo "Decrypt String : $dstr<br />";echo 'each not change<br>';$mstr = AesCtr::encrypt('Hello World', 'key', 256, 1); // keep=1
    echo "Encrypt String : $mstr<br />";$dstr = AesCtr::decrypt($mstr, 'key', 256);
    echo "Decrypt String : $dstr<br />";
    ?>