本人是vb初学者,现有一困难向各位大哥求教.在以存在的一txt文件中有类似如下内容: 
 中国 北京  abc123 
 日本 东京  ccb123 
 美国 纽约  xcx120 
  ....... 
  ....... 
现在需要 
1.用vb读给文件,使用rot13加密法对文字进行加密,写入新的txt文件. 
2.使用rot13解密,再次生成新的txt文件讲解密的内容写入 
请哪位高手给出具体答案.在下感激不尽!

解决方案 »

  1.   

    rot13处理汉字是什么规则呢?
      

  2.   

    网上搜来的函数
    Public Function Rot13(ByVal j As String) As String
        Dim c As Long
        Dim t As String
        t = j
        For i = 1 To Len(j)
            t = Right(t, Len(j) - i + 1)
            c = Asc(t)
            If (c > 64) And (c < 78) Then
                Rot13 = Rot13 + Chr(c + 13)
            ElseIf (c > 77) And (c < 91) Then
                Rot13 = Rot13 + Chr(c - 13)
            ElseIf (c > 96) And (c < 110) Then
                Rot13 = Rot13 + Chr(c + 13)
            ElseIf (c > 109) And (c < 123) Then
                Rot13 = Rot13 + Chr(c - 13)
            Else
                Rot13 = Rot13 + Chr(c)
            End If
        Next i
    End FunctionPrivate Sub Command1_Click()
        Dim strBuff As String
        Dim i As Long
        Open "f:\file.txt" For Output As #1
        Open "f:\newfile.txt" For Input As #2
        Do While (Not EOF(1))
            Line Input #1, strBuff
            strBuff=Rot13(strBuff)
            Print #2, strBuff
        Loop
        Close (1)
        Close (2)
    End Sub
      

  3.   

    to r2d4g() 
    确实不知道怎么处理中文
    网上搜了一下,对于rot13算法的描述都只提到了英文字母,连数字都不加密,更加不会处理中文。
      

  4.   

    http://www.rot13.com/index.php
    这里提供了在线rot13转换,它也没有转换汉字和数字
    楼主也许应该考虑换一个算法做加密了
      

  5.   

    现在就看你要怎么办了,反正rot13加密就是这样子
    一定要用这个加密算法吗?