字符串加密问题,如"abc",加密后为"bcd",需要还原!!

奇型怪状 2005-07-25 11:37:54
如题!
英文的好解决,ascii码值加1就行, 就是处理中文的不行啊!
请高手指点啊,
...全文
357 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
ljqhbt 2005-07-27
  • 打赏
  • 举报
回复
我自己用的两个方法:
'加密
function encode(soStr)
for i=1 to len(soStr)'加密方法1
TempNum=hex(asc(mid(soStr,i,1)))
if len(TempNum)=4 then
encode=encode & "%"& left(cstr(TempNum),2) & "%"& right(cstr(TempNum),2)
else
Randomize
encode=encode &"%"& chr(72+int(rnd*18))& chr(72+int(rnd*18)) & "%" & cstr(TempNum)
end if
next
end function
'function encodeTWO(soStr)
'for i = 1 to len(soStr)'加密方法2
' x = asc(mid(soStr,i,1))
'if x < 0 or x > 255 then
'y = x xor 010101
'else
'y = x xor 010
'end if
'encodeTWO =encodeTWO&chr(y)
'next
'end function

'解密:
function decode(x)
x=replace(x,"%","")'解密方法1
for i=1 to len(x)
if asc(mid(x,i,1))>=72 then
x=replace(x,mid(x,i,1),"0")
end if
next
for i=1 to len(x) step 4
decode=decode& chr(int("&H" & mid(x,i,4)))
next
end function
'function decode(x)
'for k=1 to len(x)'解密方法2
'i = asc(mid(x,k,1))
'if i < 0 or i > 255 then
'w = i xor 010101
'else
'w = i xor 010
'end if
'decode=decode&chr(w)
'next
'end function
ljqhbt 2005-07-27
  • 打赏
  • 举报
回复
文字也可以用ASC啊,baidu,google不都是这样简单的中文加密吗?
csecong 2005-07-27
  • 打赏
  • 举报
回复
中文也可以啊,先把字符库调出来写入库,然后^_^~

比如区位用的4位数字代表某个字,+1就行了

nnjieguo 2005-07-27
  • 打赏
  • 举报
回复
要轉成什麽樣的中文,舉個例子先啊!
goodtpg 2005-07-26
  • 打赏
  • 举报
回复
我也想知道~~关注中~~
奇型怪状 2005-07-26
  • 打赏
  • 举报
回复

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧