VB.NET 2003登录时密码加密要如何实现?
帮帮忙啊 --------------------编程问答-------------------- 加密解密http://zhidao.baidu.com/question/26753307.html --------------------编程问答-------------------- 具体要怎么实现?我对加密一点都不懂 界面要怎么设计啊 加密和登录页面是同一个吗 --------------------编程问答-------------------- 和普通的登录页面是一样的。
用wtuqi提供的例子里的函数:Dim sPwd As String = myEncrypt(txtPassword.Text).ToString()
就可以得到加密后的密码了 --------------------编程问答-------------------- Public mCSP As SymmetricAlgorithm = New DESCryptoServiceProvider
Public CIV As String = "kXwL7X2+fgM=" '//密钥
Public CKEY As String = "FwGQWRRgKCI=" '//初始化向量
Public Function EncryptString(ByVal Value As String) As String '加密的过程
Dim ct As ICryptoTransform
Dim ms As MemoryStream
Dim cs As CryptoStream
Dim byt() As Byte
ct = mCSP.CreateEncryptor(Convert.FromBase64String(CKEY), Convert.FromBase64String(CIV))
byt = Encoding.UTF8.GetBytes(Value)
ms = New MemoryStream
cs = New CryptoStream(ms, ct, CryptoStreamMode.Write)
cs.Write(byt, 0, byt.Length)
cs.FlushFinalBlock()
cs.Close()
Return Convert.ToBase64String(ms.ToArray())
End Function
Public Function DecryptString(ByVal Value As String) As String '解密的过程
Dim ct As ICryptoTransform
Dim ms As MemoryStream
Dim cs As CryptoStream
Dim byt() As Byte
ct = mCSP.CreateDecryptor(Convert.FromBase64String(CKEY), Convert.FromBase64String(CIV))
byt = Convert.FromBase64String(Value)
ms = New MemoryStream
cs = New CryptoStream(ms, ct, CryptoStreamMode.Write)
cs.Write(byt, 0, byt.Length)
cs.FlushFinalBlock()
cs.Close()
Return Encoding.UTF8.GetString(ms.ToArray())
End Function
--------------------编程问答-------------------- 顶楼上 --------------------编程问答-------------------- 4楼的不错 --------------------编程问答-------------------- 学习中
补充:.NET技术 , VB.NET