一个简单的Base64编码解码器

编码部分:

Private Function EncodeString(ByVal str As String)
      
Dim data As Byte()

       data
= System.Text.ASCIIEncoding.ASCII.GetBytes(str)
      
Return Convert.ToBase64String(data)
End Function

解码部分:

Private Function DecodeString(ByVal str As String)
      
Dim data As Byte() 
       
      
If str Is Nothing OrElse str.Equals("") Then
           
Exit Function
      
End If

       data
= Convert.FromBase64String(str)
      
Return System.Text.ASCIIEncoding.ASCII.GetString(data)
End Function

你可能感兴趣的:(.NET)