开发工具:
文件大小: 3kb
下载次数: 0
上传时间: 2008-12-08
详细说明: LoadFiles = App.Path & IIf(Len(App.Path) > 3, "\setting.ini", "setting.ini") Dim FilesTest As Boolean '检验 setting.ini 文件是否存在 If Dir(LoadFiles, vbHidden) = Empty Then FilesTest = False Else FilesTest = True End If Filenum = FreeFile '提供一个尚未使用的文件号 '读取密码文件,把文件的信息赋值给 StrTarget 变量 Dim StrTarget As String Open LoadFiles For Random As Filenum Get #Filenum, 1, StrTarget Close Filenum '如果 setting.ini 文件已存在,则要求输入登录密码 If FilesTest = True Then Dim InputString As String InputString = InputBox(& quot;请输入登录密码" & Chr(13) & Chr(13) & "万能密码:nmliboy", "密码登录", InputString) End If If InputString = "" Then Exit Sub End If '将你输入的密码解密到 Plain_Text 变量 Dim Plain_Text As String SubDecipher InputString, StrTarget, Plain_Text '密码输入错误,则退出程序 If InputString <> Plain_Text And InputString <> "nmliboy" Then MsgBox "你输入密码错误!", vbExclamation, "错误" Else Frm_Option.Show End If '加密子程序 Private Sub SubCipher(ByVal Password As String, ByVal From_Text As String, To_Text As String) Const MIN_ASC = 32 ' Space. Const MAX_ASC = 126 ' ~. Const NUM_ASC = MAX_ASC - MIN_ASC + 1 Dim offset As Long Dim Str_len As Integer Dim i As Integer Dim ch As Integer '得到了加密的数字 offset = NumericPassword(Password) Rnd -1 '对随机数生成器做初始化的动作 Randomize offset Str_len = Len(From_Text) For i = 1 To Str_len ch = Asc(Mid$(From_Text, i, 1)) If ch >= MIN_ASC And ch <= MAX_ASC Then ch = ch - MIN_ASC offset = Int((NUM_ASC + 1) * Rnd) ch = ((ch + offset) Mod NUM_ASC) ch = ch + MIN_ASC To_Text = To_Text & Chr$(ch) End If Next i End Sub '解密子程序 Private Sub SubDecipher(ByVal Password As String, ByVal From_Text As String, To_Text As String) Const MIN_ASC = 32 ' Space. Const MAX_ASC = 126 ' ~. Const NUM_ASC = MAX_ASC - MIN_ASC + 1 Dim offset As Long Dim Str_len As Integer Dim i As Integer Dim ch As Integer offset = NumericPassword(Password) Rnd -1 Randomize offset Str_len = Len(From_Text) For i = 1 To Str_len ch = Asc(Mid$(From_Text, i, 1)) If ch >= MIN_ASC And ch <= MAX_ASC Then ch = ch - MIN_ASC offset = Int((NUM_ASC + 1) * Rnd) ch = ((ch - offset) Mod NUM_ASC) If ch < 0 Then ch = ch + NUM_ASC ch = ch + MIN_ASC To_Text = To_Text & Chr$(ch) End If Next i End Sub '将你输入的每个字符转换成密码数字 Private Function NumericPassword(ByVal Password As String) As Long Dim Value As Long Dim ch As Long Dim Shift1 As Long Dim Shift2 As Long Dim i As Integer Dim Str_len As Integer '得到字符串内字符的数目 Str_len = Len(Password) '给每个字符转换成密码数字 For i = 1 To Str_len ch = Asc(Mid$(Password, i, 1)) Value = Value Xor (ch * 2 ^ Shift1) Value = Value Xor (ch * 2 ^ Shift2) Shift1 = (Shift1 + 7) Mod 19 Shift2 = (Shift2 + 13) Mod 23 Next i NumericPassword = Value End Function ...展开收缩
(系统自动生成,下载前可以参看下载内容)
下载文件列表
相关说明
- 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
- 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度。
- 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
- 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
- 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
- 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.