| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 6236 人关注过本帖, 3 人收藏
标题:加密-解密TXT文件
取消只看楼主 加入收藏
花三千
Rank: 1
等 级:新手上路
帖 子:13
专家分:0
注 册:2007-9-12
收藏(3)
 问题点数:0 回复次数:1 
加密-解密TXT文件
加密-解密TXT文件
将以下代码复制保存为333.VBS文件,奇数次运行该VBS文件是加密你要加密的TXT文件,
偶数次运行该VBS文件是解密你已加密的TXT文件

'***-----***-------***加密-解密.vbs***-----***------****

z=inputbox("请输入路径","加密-解密TXT文件","e:\12345\123.txt")

'---------------------------------------------1
set fso=CreateObject("Scripting.FileSystemObject")
set fsofile=fso.OpenTextFile(z, 1, true)
tempstr=fsofile.Readall
tempstr=replace(tempstr, "a", "※")
tempstr=replace(tempstr, "b", "£")
tempstr=replace(tempstr, "c", "¥")
tempstr=replace(tempstr, "d", "¢")
tempstr=replace(tempstr, "e", "¬")
tempstr=replace(tempstr, "f", "]")

tempstr=replace(tempstr, "※", "f")
tempstr=replace(tempstr, "£", "e")
tempstr=replace(tempstr, "¥", "d")
tempstr=replace(tempstr, "¢", "c")
tempstr=replace(tempstr, "¬", "b")
tempstr=replace(tempstr, "]", "a")
fsofile.close
set fsofile1=fso.OpenTextFile(z, 2, true)
fsofile1.WriteLine tempstr
fsofile1.close
'---------------------------------------------2
set fso=CreateObject("Scripting.FileSystemObject")
set fsofile=fso.OpenTextFile(z, 1, true)
tempstr=fsofile.Readall
tempstr=replace(tempstr, "g", "※")
tempstr=replace(tempstr, "h", "£")
tempstr=replace(tempstr, "i", "¥")
tempstr=replace(tempstr, "1", "¢")
tempstr=replace(tempstr, "2", "¬")
tempstr=replace(tempstr, "3", "]")

tempstr=replace(tempstr, "※", "3")
tempstr=replace(tempstr, "£", "2")
tempstr=replace(tempstr, "¥", "1")
tempstr=replace(tempstr, "¢", "i")
tempstr=replace(tempstr, "¬", "h")
tempstr=replace(tempstr, "]", "g")
fsofile.close
set fsofile1=fso.OpenTextFile(z, 2, true)
fsofile1.WriteLine tempstr
fsofile1.close
'---------------------------------------------3
set fso=CreateObject("Scripting.FileSystemObject")
set fsofile=fso.OpenTextFile(z, 1, true)
tempstr=fsofile.Readall
tempstr=replace(tempstr, "j", "※")
tempstr=replace(tempstr, "k", "£")
tempstr=replace(tempstr, "l", "¥")
tempstr=replace(tempstr, "4", "¢")
tempstr=replace(tempstr, "5", "¬")
tempstr=replace(tempstr, "6", "]")

tempstr=replace(tempstr, "※", "6")
tempstr=replace(tempstr, "£", "5")
tempstr=replace(tempstr, "¥", "4")
tempstr=replace(tempstr, "¢", "l")
tempstr=replace(tempstr, "¬", "k")
tempstr=replace(tempstr, "]", "j")
fsofile.close
set fsofile1=fso.OpenTextFile(z, 2, true)
fsofile1.WriteLine tempstr
fsofile1.close
'---------------------------------------------4
set fso=CreateObject("Scripting.FileSystemObject")
set fsofile=fso.OpenTextFile(z, 1, true)
tempstr=fsofile.Readall
tempstr=replace(tempstr, "m", "※")
tempstr=replace(tempstr, "n", "£")
tempstr=replace(tempstr, "o", "¥")
tempstr=replace(tempstr, ",", "¢")
tempstr=replace(tempstr, ".", "¬")
tempstr=replace(tempstr, "/", "]")

tempstr=replace(tempstr, "※", "/")
tempstr=replace(tempstr, "£", ".")
tempstr=replace(tempstr, "¥", ",")
tempstr=replace(tempstr, "¢", "o")
tempstr=replace(tempstr, "¬", "n")
tempstr=replace(tempstr, "]", "m")
fsofile.close
set fsofile1=fso.OpenTextFile(z, 2, true)
fsofile1.WriteLine tempstr
fsofile1.close
'---------------------------------------------5
set fso=CreateObject("Scripting.FileSystemObject")
set fsofile=fso.OpenTextFile(z, 1, true)
tempstr=fsofile.Readall
tempstr=replace(tempstr, "p", "※")
tempstr=replace(tempstr, "q", "£")
tempstr=replace(tempstr, "r", "¥")
tempstr=replace(tempstr, " ", "¢")
tempstr=replace(tempstr, "\", "¬")
tempstr=replace(tempstr, "=", "]")

tempstr=replace(tempstr, "※", "=")
tempstr=replace(tempstr, "£", "\")
tempstr=replace(tempstr, "¥", " ")
tempstr=replace(tempstr, "¢", "r")
tempstr=replace(tempstr, "¬", "q")
tempstr=replace(tempstr, "]", "p")
fsofile.close
set fsofile1=fso.OpenTextFile(z, 2, true)
fsofile1.WriteLine tempstr
fsofile1.close
'---------------------------------------------6
set fso=CreateObject("Scripting.FileSystemObject")
set fsofile=fso.OpenTextFile(z, 1, true)
tempstr=fsofile.Readall
tempstr=replace(tempstr, "s", "※")
tempstr=replace(tempstr, "t", "£")
tempstr=replace(tempstr, "u", "¥")
tempstr=replace(tempstr, "7", "¢")
tempstr=replace(tempstr, "8", "¬")
tempstr=replace(tempstr, "9", "]")

tempstr=replace(tempstr, "※", "9")
tempstr=replace(tempstr, "£", "8")
tempstr=replace(tempstr, "¥", "7")
tempstr=replace(tempstr, "¢", "u")
tempstr=replace(tempstr, "¬", "t")
tempstr=replace(tempstr, "]", "s")
fsofile.close
set fsofile1=fso.OpenTextFile(z, 2, true)
fsofile1.WriteLine tempstr
fsofile1.close
'---------------------------------------------7
set fso=CreateObject("Scripting.FileSystemObject")
set fsofile=fso.OpenTextFile(z, 1, true)
tempstr=fsofile.Readall
tempstr=replace(tempstr, "v", "※")
tempstr=replace(tempstr, "w", "£")
tempstr=replace(tempstr, "x", "¥")
tempstr=replace(tempstr, "%", "¢")
tempstr=replace(tempstr, ")", "¬")
tempstr=replace(tempstr, "(", "]")

tempstr=replace(tempstr, "※", "(")
tempstr=replace(tempstr, "£", ")")
tempstr=replace(tempstr, "¥", "%")
tempstr=replace(tempstr, "¢", "x")
tempstr=replace(tempstr, "¬", "w")
tempstr=replace(tempstr, "]", "v")
fsofile.close
set fsofile1=fso.OpenTextFile(z, 2, true)
fsofile1.WriteLine tempstr
fsofile1.close
msgbox "OK"

[此贴子已经被作者于2007-10-14 20:25:45编辑过]

搜索更多相关主题的帖子: TXT文件 解密 fso set 
2007-10-14 20:09
花三千
Rank: 1
等 级:新手上路
帖 子:13
专家分:0
注 册:2007-9-12
收藏
得分:0 
对文字有用啊
例如:tempstr=replace(tempstr, "小鸡巴", "大大的")
就把"小鸡巴"换成了"大大的"

2007-11-03 11:44
快速回复:加密-解密TXT文件
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.081969 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved