免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1846 | 回复: 7
打印 上一主题 下一主题

有加密解密的高手吗?帮我把一ASP函数转为PHP函数! [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2005-06-28 13:28 |只看该作者 |倒序浏览

  1. <%
  2. mainKey = "u67(%#@d^J(>;HTtdi"
  3. 'keyGeN 加密长度暂时为 8
  4. Function XOR_ENS(Source, Key) '加密函数
  5.    Dim i, iKey, iKeyLen
  6.    Dim SSA, SSB, SSS
  7.    Dim XOR_STR_A
  8.    Select Case Len(Source)
  9.       Case 1
  10.           Source = Source & Chr(32) & Chr(32) & Chr(32) & Chr(32)
  11.       Case 2
  12.           Source = Source & Chr(32) & Chr(32) & Chr(32)
  13.       Case 3
  14.           Source = Source & Chr(32) & Chr(32)
  15.       Case 4
  16.           Source = Source & Chr(32)
  17.     End Select
  18.     XOR_STR_A = ""
  19.     iKeyLen = Len(Key)
  20.     iKey = 1
  21.     'Source = StrConv(Source, vbFromUnicode)
  22.     For i = 1 To LenB(Source)
  23.         SSA = CInt(AscB(MidB(Source, i, 1)))
  24.         SSB = CInt(Asc(Mid(Key, iKey, 1)))
  25.         iKey = iKey + 1
  26.         If iKey >; iKeyLen Then
  27.             iKey = 1
  28.         End If
  29.         SSS = SSA Xor SSB
  30.         XOR_STR_A = XOR_STR_A & Right("0" & Hex(SSS), 2)
  31.     Next
  32.     XOR_ENS = XOR_STR_A
  33.     XOR_ENS = Replace(XOR_ENS, "1", "*")
  34.     XOR_ENS = Replace(XOR_ENS, "9", "1")
  35.     XOR_ENS = Replace(XOR_ENS, "*", "9")
  36.     XOR_ENS = Replace(XOR_ENS, "8", "#")
  37.     XOR_ENS = Replace(XOR_ENS, "2", "8")
  38.     XOR_ENS = Replace(XOR_ENS, "#", "2")
  39.     XOR_ENS = Replace(XOR_ENS, "4", "#")
  40.     XOR_ENS = Replace(XOR_ENS, "7", "4")
  41.     XOR_ENS = Replace(XOR_ENS, "#", "7")
  42.     XOR_ENS = Replace(XOR_ENS, "3", "#")
  43.     XOR_ENS = Replace(XOR_ENS, "6", "3")
  44.     XOR_ENS = Replace(XOR_ENS, "#", "6")
  45.     XOR_ENS = Replace(XOR_ENS, "D", "#")
  46.     XOR_ENS = Replace(XOR_ENS, "F", "D")
  47.     XOR_ENS = Replace(XOR_ENS, "#", "F")
  48.     XOR_ENS = Replace(XOR_ENS, "A", "#")
  49.     XOR_ENS = Replace(XOR_ENS, "B", "A")
  50.     XOR_ENS = Replace(XOR_ENS, "#", "B")
  51. End Function
  52. Function XOR_DES(Source, Key)  ' 解密函数
  53.     Dim i, iKey, iKeyLen
  54.     Dim SSA, SSB, SSS
  55.     Dim XOR_STR_A
  56.     XOR_STR_A = ""
  57.     iKeyLen = Len(Key)
  58.     iKey = 1
  59.     XOR_STR_A = ""
  60.     Source = Replace(Source, "1", "*")
  61.     Source = Replace(Source, "9", "1")
  62.     Source = Replace(Source, "*", "9")
  63.     Source = Replace(Source, "8", "#")
  64.     Source = Replace(Source, "2", "8")
  65.     Source = Replace(Source, "#", "2")
  66.     Source = Replace(Source, "4", "#")
  67.     Source = Replace(Source, "7", "4")
  68.     Source = Replace(Source, "#", "7")
  69.     Source = Replace(Source, "3", "#")
  70.     Source = Replace(Source, "6", "3")
  71.     Source = Replace(Source, "#", "6")
  72.     Source = Replace(Source, "D", "#")
  73.     Source = Replace(Source, "F", "D")
  74.     Source = Replace(Source, "#", "F")
  75.     Source = Replace(Source, "A", "#")
  76.     Source = Replace(Source, "B", "A")
  77.     Source = Replace(Source, "#", "B")
  78.    
  79.     For i = 1 To Len(Source) Step 2
  80.         SSA = CInt("&H" & (Mid(Source, i, 2)))
  81.         SSB = (Asc(Mid(Key, iKey, 1)))
  82.         iKey = iKey + 1
  83.         If iKey >; iKeyLen Then
  84.             iKey = 1
  85.         End If
  86.         SSS = SSA Xor SSB
  87.         XOR_STR_A = XOR_STR_A & ChrB(SSS)
  88.     Next
  89.   '  XOR_DES = StrConv(XOR_STR_A, vbUnicode)
  90.    ' XOR_DES = replace(XOR_STR_A,vbcrlf,"",lenB(XOR_STR_A)-4)
  91.     xor_des=trim(XOR_STR_A)
  92.     xor_des=cstr(xor_des)
  93. End Function
  94.                                         '产生密钥算法
  95. Function KeyGeN(iKeyLength)
  96.     Dim k, iCount, strMyKey
  97.     lowerbound = 35
  98.     upperbound = 96
  99.     Randomize
  100.     For i = 1 To iKeyLength
  101.         k = Int(((upperbound - lowerbound) + 1) * Rnd + lowerbound)
  102.         strMyKey = strMyKey & Chr(k) & ""
  103.     Next
  104.     KeyGeN = strMyKey
  105. End Function
  106. %>;
复制代码


我想把这几个ASP函数转为PHP的加密解密,有没有办法?

论坛徽章:
1
荣誉版主
日期:2011-11-23 16:44:17
2 [报告]
发表于 2005-06-28 16:07 |只看该作者

有加密解密的高手吗?帮我把一ASP函数转为PHP函数!

md5,取一部分...

论坛徽章:
0
3 [报告]
发表于 2005-06-28 22:23 |只看该作者

有加密解密的高手吗?帮我把一ASP函数转为PHP函数!

老大,我是要把ASP的这几个转成PHP的!我这个可以加密整篇文章,解密函数还可以还原整篇文章,MD5是搞不了的!

论坛徽章:
0
4 [报告]
发表于 2005-06-29 08:49 |只看该作者

有加密解密的高手吗?帮我把一ASP函数转为PHP函数!

把每个语句换成相应的php不行吗。

论坛徽章:
0
5 [报告]
发表于 2005-06-29 10:46 |只看该作者

有加密解密的高手吗?帮我把一ASP函数转为PHP函数!

就是不会转才来这儿贴的嘛,呵呵

论坛徽章:
0
6 [报告]
发表于 2005-06-29 19:26 |只看该作者
提示: 作者被禁止或删除 内容自动屏蔽

论坛徽章:
0
7 [报告]
发表于 2005-06-30 09:25 |只看该作者

有加密解密的高手吗?帮我把一ASP函数转为PHP函数!

有一个软件叫 asp2php  你可以试一下

试了,转过来的不能用!

论坛徽章:
0
8 [报告]
发表于 2005-07-03 14:56 |只看该作者

有加密解密的高手吗?帮我把一ASP函数转为PHP函数!

顶一下!!
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP