资 源 简 介
Module Encrptoy Public Function Encrptoy(ByVal PtoEncoding As String, ByVal Skey As String) As String Dim des As New DESCryptoServiceProvider Dim _byte As Byte() _byte = Encoding.Default.GetBytes(PtoEncoding) des.Key = Encoding.Default.GetBytes(Skey) des.IV = Encoding.Default.GetBytes(Skey) Dim ms As New System.IO.MemoryStream() Dim cs As New CryptoStream(ms, des.CreateEncryptor, CryptoStreamMode.Write) cs.Write(_byte, 0, _byte.Length) cs.FlushFinalBlock() Return Convert.ToBase64String(ms.ToArray()) End Function Public Function Dencrptoy(ByVal PtoDencoding As String, ByVal skey As String) As String Dim des As New DESCryptoServiceProvider() Dim _byte As Byte() _byte = Convert.FromBase64String(PtoDencoding) des.IV = Encoding.Default.GetBytes(skey) des.Key = Encoding.Default.GetBytes(skey) Dim ms As New IO.MemoryStream Dim cstream As New CryptoStream(ms, des.CreateDecryptor, CryptoStreamMode.Write) cstream.Write(_byte, 0, _byte.Length) cstream.FlushFinalBlock() Return Encoding.Default.GetString(ms.ToArray()) End FunctionEnd Module