zoukankan      html  css  js  c++  java
  • Authcode()

    加密解密函数Authcode():

    1.  // 参数解释   
    2. // $string: 明文 或 密文   
    3. // $operation:DECODE表示解密,其它表示加密   
    4. // $key: 密匙   
    5. // $expiry:密文有效期   
    6. function authcode($string, $operation = 'DECODE', $key = '', $expiry = 0) {   
    7.     // 动态密匙长度,相同的明文会生成不同密文就是依靠动态密匙   
    8.     $ckey_length = 4;   
    9.        
    10.     // 密匙   
    11.     $key = md5($key ? $key : $GLOBALS['discuz_auth_key']);   
    12.        
    13.     // 密匙a会参与加解密   
    14.     $keya = md5(substr($key, 0, 16));   
    15.     // 密匙b会用来做数据完整性验证   
    16.     $keyb = md5(substr($key, 16, 16));   
    17.     // 密匙c用于变化生成的密文   
    18.     $keyc = $ckey_length ? ($operation == 'DECODE' ? substr($string, 0, $ckey_length):
    substr(md5(microtime()), -$ckey_length)) : '';   
    19.     // 参与运算的密匙   
    20.     $cryptkey = $keya.md5($keya.$keyc);   
    21.   &

  • 相关阅读:
    转:孙振耀谈人生(推荐)
    自绘按钮的实现
    数据结构知识
    Direct Show采集图像实例
    视觉跟踪
    改变对话框控件的颜色
    笔试题
    CBitmapButton的使用
    Rotor (SSCLI) 2.0 登场!
    Under the hood: 从Win32 SEH到CLI异常处理模型
  • 原文地址:https://www.cnblogs.com/wanlibingfeng/p/6047157.html
Copyright © 2011-2022 走看看