• 新浪微博:
  • 微信 :
按键精灵电脑版
立即下载

软件版本:2014.05
软件大小:21.6M
更新时间:07-04

按键精灵安卓版
立即下载

软件版本:3.3.1
软件大小:62.5M
更新时间:5-24

按键精灵iOS版
立即下载

软件版本:1.3.5
软件大小:29.2M
更新时间:06-14

最新企业版UiBot
立即下载

软件版本:2.5
软件大小:181M
更新时间:05-20

快捷导航

登录 后使用快捷导航
没有帐号? 注册

登录 注册
返回列表 12345678» / 9
发新话题 回复该主题

[源码分享] 验证思路 仅供参考 [复制链接]

1#
好久没出来冒泡了 刷下存在感
本代码可生成月卡,季卡,年卡!但由于并未采用网络时间,所以安全系数还是比较低的,仅供参考
代码仅是一部分,对于怎么加强安全性不被破解就看大家的了
代码回复可见
  1. //加密部分及加密原理,仅供参考可自行替换

  2. //A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
  3. //1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
  4. //1代表年,8代表月,5代表日,0代表月卡,3代表季卡,76代表年卡
  5. //附加码2,4,9

  6. Dim temp
  7. temp = setCode("15,3,21,季卡")
  8. TracePrint "生成卡密:" & temp

  9. Function setCode(input)//生成卡密
  10. dim arr(),Myvalue,j=5,password,tver,strs,passwordFirst,passwordLast
  11. strs = Split(input, ",")//分割输入的验证信息
  12. tver = convert(Int(strs(0)), Int(strs(1)), Int(strs(2)), strs(3))//对验证信息转换
  13. TracePrint "验证信息加密:" & tver
  14. Randomize
  15. //随机产生5组附加码
  16. For i = 0 To 4
  17. arr(i) = UCase(Str.RndLetter())
  18. MyValue = Int(((3-1+1)* Rnd()) + 1)
  19. If MyValue = 1 Then
  20. arr(i)=arr(i)&"2"
  21. ElseIf MyValue = 2 Then
  22. arr(i)=arr(i)&"4"
  23. ElseIf MyValue = 3 Then
  24. arr(i)=arr(i)&"9"
  25. End If
  26. Next
  27. //对转换后的验证信息分组
  28. For i = 1 To Len(tver) step 2
  29. arr(j) = Mid(tver, i, 2)
  30. j = j+1
  31. Next
  32. //将验证信息与附加码进行随机重组
  33. arr = rndArray(arr, Len(tver) / 2 + 4)
  34. //产生原始卡密
  35. For i = 0 To len(tver)/2+4
  36. password=password&arr(i)
  37. Next
  38. //对原始卡密进行截取逆序输出并打乱顺序
  39. passwordFirst = StrReverse(Mid(password, 1, Len(password) / 2))
  40. passwordLast = StrReverse(Mid(password, Len(password) / 2 + 1, Len(password) / 2))
  41. TracePrint passwordFirst & "," & passwordLast
  42. password = passwordLast & passwordFirst
  43. setCode=password
  44. End Function

  45. Function rndArray(arrName, max)//数组随机排序
  46. Dim R,temp
  47. For max * 2
  48. R = Int(((max-0+1)* Rnd()))
  49. temp=arrName(R)
  50. arrName(R)=arrName(0)
  51. arrName(0)=temp
  52. Next
  53. rndArray=arrName
  54. End Function

  55. Function convert(year,month,day,cardType)//验证信息转换
  56. Dim yearFirst,yearLast,dayFirst,dayLast,cardTypeFirst,cardTypeLast,newYear,newMonth,newDay,newCardType,num
  57. Randomize
  58. //对年信息分解并加密
  59. yearFirst = Int((((year-1) - 1 + 1) * Rnd()) + 1)
  60. yearLast = year - yearFirst
  61. newYear = encrypt(yearFirst, yearLast, 1)
  62. TracePrint "年分解:" & yearFirst & "," & yearLast & ",加密:" & newYear
  63. //对月信息加密
  64. newMonth = encrypt(month, -1, 8)
  65. TracePrint "月加密:" & newMonth
  66. //对日信息判断并分解加密
  67. If day < 26 Then num = day - 1 Else num = 25
  68. dayFirst = Int(((num - 1 + 1) * Rnd()) + 1)
  69. dayLast = day - dayFirst
  70. newDay = encrypt(dayFirst, dayLast, 5)
  71. TracePrint "日分解:" & dayFirst & "," & dayLast & ",加密:" & newDay
  72. //对卡信息判断并分解加密
  73. If cardType = "月卡" Then
  74. cardTypeFirst = Int(((26 - 10 + 1) * Rnd()) + 10)
  75. cardTypeLast = 30 - cardTypeFirst
  76. newCardType = encrypt(cardTypeFirst, cardTypeLast, 0)
  77. TracePrint "月卡分解:" & cardTypeFirst & "," & cardTypeLast & ",加密:" & newCardType
  78. ElseIf cardType = "季卡" Then
  79. cardTypeFirst = Int(((26 - 10 + 1) * Rnd()) + 10)
  80. cardTypeLast = 30 - cardTypeFirst
  81. newCardType = encrypt(cardTypeFirst, cardTypeLast, 3)
  82. TracePrint "季卡分解:" & cardTypeFirst & "," & cardTypeLast & ",加密:" & newCardType
  83. ElseIf cardType = "年卡" Then
  84. newCardType="C7F6E7"
  85. End If
  86. //返回加密后的验证信息
  87. convert = newYear & newMonth & newDay & newCardType
  88. End Function

  89. Function encrypt(First,Last,Type)//验证信息加密
  90. Dim arr,value,temp
  91. arr = Array("*", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z")
  92. For i = 0 To 26
  93. If First = i Then //对指定数字进行转换
  94. If Last = -1 Then
  95. value = value & arr(i) & Type
  96. Exit For
  97. Else
  98. value = value & arr(i) & Type & arr(Last) & Type
  99. Exit For
  100. End If
  101. End If
  102. Next
  103. encrypt = value
  104. End Function

  105. //解密部分
  106. TracePrint "卡密中的验证信息为:" & getCode(temp)

    Function getCode(code)//分析卡密

  107. Dim arr(),year=0,month,day=0,cardType,j=0,codeFirst,codeLast
  108. //将卡密逆序输出并重组顺序
  109. codeFirst = StrReverse(Mid(code, 1, Len(code) / 2))
  110. codeLast = StrReverse(Mid(code, Len(code) / 2 + 1, Len(code) / 2))
  111. code = codeLast & codeFirst
  112. //将卡密信息分组
  113. For i = 1 To Len(code) Step 2
  114. arr(j) = Mid(code, i, 2)
  115. j = j + 1
  116. Next
  117. //对已分组的卡密信息进行验证信息提取
  118. For i = 0 To Len(code)/2 - 1
  119. If Right(arr(i), 1) = "1" Then
  120. //解密年信息
  121. year = year + decode(Left(arr(i), 1))
  122. ElseIf Right(arr(i), 1) = "8" Then
  123. //解密月信息
  124. month = decode(Left(arr(i), 1))
  125. ElseIf Right(arr(i), 1) = "5" Then
  126. //解密日信息
  127. day = day + decode(Left(arr(i), 1))
  128. ElseIf Right(arr(i), 1) = "0" Then
  129. //解密月卡信息
  130. cardType="月卡"
  131. ElseIf Right(arr(i), 1) = "3" Then
  132. //解密季卡信息
  133. cardType="季卡"
  134. ElseIf Right(arr(i), 1) = "7" or Right(arr(i), 1) = "6" Then
  135. //解密年卡信息
  136. cardType="年卡"
  137. End If
  138. Next
  139. //返回解密后的信息
  140. getCode = year & "年" & month & "月" & day & "日,卡类型:" & cardType
  141. End Function

    Function decode(tver)//验证信息解密

  142. Dim arr,value
  143. arr = Array("*", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z")
  144. For i = 0 To 26//对指定的字母进行转换
  145. If arr(i) = tver Then
  146. value = i
  147. Exit For
  148. End If
  149. Next
  150. decode = value
  151. End Function


复制代码

2#

fgbdghf

3#

悟空,看看!

吾爱按键!
4#

看看来看看

5#

。。。

6#

先顶一个再看

7#


学习群490076005
8#

kankan

9#

11111111111

10#

仅供参考修改

11#

谢谢分享了吖…………

12#

加速头托你

13#


14#

啦啦啦啦啦啦啦啦

15#

看看代码

16#

证思路 仅供参考修

17#

6666666666666666

18#

学习下

19#

悟能,为师找你很久了

WWW.92AJ.CN
承接中小型 游戏/办公/投票/自动发货类 脚本
如果回答对你有所帮助请不要吝啬手中的鲜花
20#


发新话题 回复该主题