Foxtable(狐表)用户栏目专家坐堂 → [求助]md5加密


  共有2237人关注过本帖树形打印复制链接

主题:[求助]md5加密

帅哥哟,离线,有人找我吗?
有点甜
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2019/4/1 9:19:00 [显示全部帖子]

转换代码,请参考,细节自己调整

 

http://converter.telerik.com/

 

 


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2019/4/1 9:22:00 [显示全部帖子]

比如

 

Public Function Encrypt(ByVal Text As String, ByVal sKey As String) As String
    Dim des As System.Security.Cryptography.DESCryptoServiceProvider = New System.Security.Cryptography.DESCryptoServiceProvider()
    Dim inputByteArray As Byte()
    inputByteArray = Encoding.[Default].GetBytes(Text)
    des.Key = ASCIIEncoding.ASCII.GetBytes(System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(sKey, "md5").Substring(0, 8))
    des.IV = ASCIIEncoding.ASCII.GetBytes(System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(sKey, "md5").Substring(0, 8))
    Dim ms As System.IO.MemoryStream = New System.IO.MemoryStream()
    Dim cs As System.Security.Cryptography.CryptoStream = New System.Security.Cryptography.CryptoStream(ms, des.CreateEncryptor(), System.Security.Cryptography.CryptoStreamMode.Write)
    cs.Write(inputByteArray, 0, inputByteArray.Length)
    cs.FlushFinalBlock()
    Dim ret As StringBuilder = New StringBuilder()

    For Each b As Byte In ms.ToArray()
        ret.AppendFormat("{0:X2}", b)
    Next

    Return ret.ToString()
End Function


 回到顶部