|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
Access是一种桌面数据库,只适合数据量少的应用,在处理少量数据和单机访问的数据库时是很好的,效率也很高。但是它的同时访问客户端不能多于4个。access数据库有一定的极限,如果数据达到100M左右,很容易造成服务器iis假死,或者消耗掉服务器的内存导致服务器崩溃。加密|解密|加密|解密加密前为:1234567890<P>加密后为:MTIzNDU2Nzg5MA<P>解密后为:1234567890源码:
<%
OPTIONEXPLICIT
constBASE_64_MAP_INIT="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
dimnewline
dimBase64EncMap(63)
dimBase64DecMap(127)
初始化函数
PUBLICSUBinitCodecs()
初始化变量
newline="<P>"&chr(13)&chr(10)
dimmax,idx
max=len(BASE_64_MAP_INIT)
foridx=0tomax-1
Base64EncMap(idx)=mid(BASE_64_MAP_INIT,idx+1,1)
next
foridx=0tomax-1
Base64DecMap(ASC(Base64EncMap(idx)))=idx
next
ENDSUB
Base64加密函数
PUBLICFUNCTIONbase64Encode(plain)
iflen(plain)=0then
base64Encode=""
exitfunction
endif
dimret,ndx,by3,first,second,third
by3=(len(plain)3)*3
ndx=1
dowhilendx<=by3
first=asc(mid(plain,ndx+0,1))
second=asc(mid(plain,ndx+1,1))
third=asc(mid(plain,ndx+2,1))
ret=ret&Base64EncMap((first4)AND63)
ret=ret&Base64EncMap(((first*16)AND48)+((second16)AND15))
ret=ret&Base64EncMap(((second*4)AND60)+((third64)AND3))
ret=ret&Base64EncMap(thirdAND63)
ndx=ndx+3
loop
ifby3<len(plain)then
first=asc(mid(plain,ndx+0,1))
ret=ret&Base64EncMap((first4)AND63)
if(len(plain)MOD3)=2then
second=asc(mid(plain,ndx+1,1))
ret=ret&Base64EncMap(((first*16)AND48)+((second16)AND15))
ret=ret&Base64EncMap(((second*4)AND60))
else
ret=ret&Base64EncMap((first*16)AND48)
ret=ret&"="
endif
ret=ret&"="
endif
base64Encode=ret
ENDFUNCTION
Base64解密函数
PUBLICFUNCTIONbase64Decode(scrambled)
iflen(scrambled)=0then
base64Decode=""
exitfunction
endif
dimrealLen
realLen=len(scrambled)
dowhilemid(scrambled,realLen,1)="="
realLen=realLen-1
loop
dimret,ndx,by4,first,second,third,fourth
ret=""
by4=(realLen4)*4
ndx=1
dowhilendx<=by4
first=Base64DecMap(asc(mid(scrambled,ndx+0,1)))
second=Base64DecMap(asc(mid(scrambled,ndx+1,1)))
third=Base64DecMap(asc(mid(scrambled,ndx+2,1)))
fourth=Base64DecMap(asc(mid(scrambled,ndx+3,1)))
ret=ret&chr(((first*4)AND255)+((second16)AND3))
ret=ret&chr(((second*16)AND255)+((third4)AND15))
ret=ret&chr(((third*64)AND255)+(fourthAND63))
ndx=ndx+4
loop
ifndx<realLenthen
first=Base64DecMap(asc(mid(scrambled,ndx+0,1)))
second=Base64DecMap(asc(mid(scrambled,ndx+1,1)))
ret=ret&chr(((first*4)AND255)+((second16)AND3))
ifrealLenMOD4=3then
third=Base64DecMap(asc(mid(scrambled,ndx+2,1)))
ret=ret&chr(((second*16)AND255)+((third4)AND15))
endif
endif
base64Decode=ret
ENDFUNCTION
初始化
callinitCodecs
测试代码
diminp,encode
inp="1234567890"
encode=base64Encode(inp)
response.write"加密前为:"&inp&newline
response.write"加密后为:"&encode&newline
response.write"解密后为:"&base64Decode(encode)&newline
%>
国内有些大的CRM厂商的ASP就写得不错.无论是概念还是它里面用JAVASCRIPT的能力.并不是说现在的程序员用了ASP.NET来写程序就可以说自己高档了 |
|