标题:[求助]如何实现在VB.NET中进行MD5加密和解密,不知道那个做个,能告诉怎么写 ...
只看楼主
heyuqing0502
Rank: 1
等 级:新手上路
帖 子:24
专家分:0
注 册:2007-3-21
 问题点数:0 回复次数:1 
[求助]如何实现在VB.NET中进行MD5加密和解密,不知道那个做个,能告诉怎么写吗?
谢谢了,
搜索更多相关主题的帖子: NET 解密 
2007-06-04 12:13
sjxwb
Rank: 1
等 级:新手上路
帖 子:33
专家分:0
注 册:2007-1-11
得分:0 
Imports System.Security.Cryptography


Function MD5(ByVal input As String, ByVal coda As Integer) As String
Dim md5Hasher As New MD5CryptoServiceProvider
Dim data As Byte() = md5Hasher.ComputeHash(Encoding.Default.GetBytes(input))
Dim sBuilder As New StringBuilder
Dim i As Integer
If coda = 16 Then
For i = 4 To 11
sBuilder.Append(data(i).ToString("x2"))
Next i
Else
For i = 0 To 15
sBuilder.Append(data(i).ToString("x2"))
Next i
End If
Return sBuilder.ToString()
End Function

msgbox (md5("想要加密的字符串",16)) '返回16位的密文
msgbox (md5("想要加密的字符串",32)) '返回32位的密文
2007-06-30 21:22



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-144752-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.056668 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved