| 网站首页 | VB.Net实例分析 | .Net技术文摘 | 下载中心 | VB.Net书籍笔记 | .Net源码 | VBS脚本与组件调用 | Windows2008技术文摘 | 给我们留言 | 
最新公告:

  没有公告

您现在的位置: 乐博网 >> VB.Net应用技巧 >> 技术文摘正文
最新推荐 更多内容
VB.Net FileZilla密码加解密的方法
VB.Net FileZilla密码加解密的方法
作者:Akyao    来源:乐博网     更新时间:2011-5-20

VB.Net FileZilla密码加密解密的函数,想利用他来自动开ftp账号的朋友有福了。

代码如下:

Module Module1
    Const m_key = "FILEZILLA1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ"

   Sub Main()
        Dim InputString As String
        Dim theKey
        Dim quitenc As Boolean
        quitenc = False

        Do Until quitenc '更多.net源代码 来自乐博网lob.cn
            Console.Clear()
            Console.Write("E - Encode" & vbNewLine & "D - Decode")
            theKey = Console.ReadKey(True)
            Select Case theKey.Key
                Case ConsoleKey.E
                    Console.Write(vbNewLine & "String To Encode: ")
                    InputString = Console.ReadLine
                    Console.Write(vbNewLine & "Encoded String: " & fzenc(InputString))
                Case ConsoleKey.D
                    Console.Write(vbNewLine & "String To Decode: ")
                    InputString = Console.ReadLine
                    Console.Write(vbNewLine & "Encoded String: " & fzdec(InputString))
            End Select

            Console.Write(vbNewLine & vbNewLine & "Press Any Key To Finish or X to start again")
            theKey = Console.ReadKey(True)
            If theKey.Key = ConsoleKey.X Then quitenc = False Else quitenc = True
        Loop

    End Sub



    Function fzdec(ByVal encstring As String)
        Dim retlength As String
        Dim length As Integer


        Dim pos As Integer
        Dim m_key_length As Integer
        Dim i As Integer
        Dim ret As String

        ret = ""
        retlength = Len(encstring)

        If (Not (retlength Mod 3) = 0) Then
            Console.Write(vbNewLine & "not a valid encrypted key length" & vbNewLine)
        End If


        m_key_length = Len(m_key)
        length = retlength / 3
        pos = length Mod m_key_length
        i = 1

        Do While i < length + 1
            Dim p1, p2, p3, p4, p5
            p1 = Mid(encstring, 3 * (i - 1) + 1, 3)
            p2 = i + pos
            p3 = p2 Mod m_key_length
            If p3 = 0 Then p3 = 1
            p4 = Asc(Mid(m_key, p3, 1))
            p5 = p1 Xor p4
            ret = ret & Chr(p5)
            i = i + 1
        Loop


        Return ret

    End Function

    Function fzenc(ByVal encstring As String)
        Dim pos As Integer
        Dim m_key_length As Integer
        Dim ret As String
        Dim length As Integer
        Dim i As Integer

        pos = Len(encstring) Mod Len(m_key)
        m_key_length = Len(m_key)
        ret = ""
        length = Len(encstring)
        i = 1

        Do While i < length + 1
            Dim p1, p2, p3, p4, p5
            p1 = Asc(Mid(encstring, i, 1))
            p2 = i + pos
            p3 = p2 Mod m_key_length
            If p3 = 0 Then p3 = 1
            p4 = Asc(Mid(m_key, p3, 1))
            p5 = p1 Xor p4
            ret = ret & padwithzero(p5)
            i = i + 1
        Loop

        Return ret
    End Function

    Function padwithzero(ByVal padstr As String)
        Dim strlen As Integer
        strlen = Len(padstr)
        Dim padstr_ret As String
        padstr_ret = ""
        Do Until strlen = 3
            padstr_ret = "0" & padstr
            strlen = Len(padstr_ret)
        Loop
        Return padstr_ret
    End Function
End Module
  • 上一篇:

  • 下一篇: 没有了
  • 【字体: 】【打印此文】【关闭窗口
      相关文章:(只显示最新16条)
    C# FileZilla密码加密的源代码(乐博网原创)
    Serv-U密码加密原理并实现( ASP.NET基于C# )
    C#管理Serv-U6.4.0.6的方法
    VB.Net实现FTP编程的学习笔记.04.[乐博网]
    VB.Net实现FTP编程的学习笔记.03.[乐博网]
    VB.Net实现FTP编程的学习笔记.02.[乐博网]
    VB.Net实现FTP编程的学习笔记.01.[乐博网]
    VB.Net实现Ftp上传的方法[乐博网原创]
    VB.Net实现Ftp下载的方法[乐博网原创]
    VB.Net实现登陆Ftp的方法[乐博网原创]
    VB.Net实现FTP下载文件的两种方法

    | 设为首页 | 加入收藏 | 联系站长 | | 友情链接 | 版权申明 |
    乐博网欢迎各种媒体转载我们的原创作品[转载请注明出处];我们鼓励更多VB.Net开发者一起加入研究与探讨;如发现文章访问错误、内容错误或版权疑问、内容有违相关法律(如涉及政治、色情、反动或散布虚假有害信息)等情况,请及时向我们举报,我们将及时纠正!
    联系邮箱:Shiny#vip.qq.com (#替换为@) QQ交流群: 40797788 [闽ICP备05014267号]