最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
我的密码的加密方法: (详细讲解)(解决溢出问题)(对象初学者))
时间:2022-07-02 23:51:39 编辑:袖梨 来源:一聚教程网
我的密码的加密方法:
首先写一个加密函数encrypt(str):
<%
function encrypt(str)
Dim i,c,length,texts,seed
length = len(str)
texts = ""
for i = 1 to length
c = mid(str,i,length)
seed=Asc(c)
if seed >ASC("hh") then //
seed=seed-15 //防止溢出问题
end if //
seed=i+length+seed
texts = texts & chr(seed)
next
texts = texts & mid(str,length,length)
encrypt =texts
end function
%>
上面用的vbscript函数:
len(str) 返回字符串中的字符数目
Asc() 返回每一个字符串首字母的 ANSI 字符代码
Chr() 函数返回与指定的字符代码相对应的字符
mid(str,i,length)返回字符串str中从第i个字符开始的length个字符
另外再输入密码那个环节,用js控制只能输入
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
并限制数落密码长度,12应该可以了吧
实现函数
function CharsInBag (s, bag)
{
var i;
for (i = 0; i < s.length; i++)
首先写一个加密函数encrypt(str):
<%
function encrypt(str)
Dim i,c,length,texts,seed
length = len(str)
texts = ""
for i = 1 to length
c = mid(str,i,length)
seed=Asc(c)
if seed >ASC("hh") then //
seed=seed-15 //防止溢出问题
end if //
seed=i+length+seed
texts = texts & chr(seed)
next
texts = texts & mid(str,length,length)
encrypt =texts
end function
%>
上面用的vbscript函数:
len(str) 返回字符串中的字符数目
Asc() 返回每一个字符串首字母的 ANSI 字符代码
Chr() 函数返回与指定的字符代码相对应的字符
mid(str,i,length)返回字符串str中从第i个字符开始的length个字符
另外再输入密码那个环节,用js控制只能输入
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
并限制数落密码长度,12应该可以了吧
实现函数
function CharsInBag (s, bag)
{
var i;
for (i = 0; i < s.length; i++)
相关文章
- 《1号会员店》关闭自动续费方法 01-29
- 《排球少年:新的征程》社团每日福利领取方法 01-29
- 《椿之歌》新手风属性队伍推荐 01-29
- 《最终幻想14:水晶世界》小小阿托莫斯宠物获得方法 01-29
- 《燕云十六声》醉拳客打法攻略 01-29
- 《异人之下》全货币获取方法汇总 01-29