快上网专注成都网站设计 成都网站制作 成都网站建设
成都网站建设公司服务热线:028-86922220

网站建设知识

十年网站开发经验 + 多家企业客户 + 靠谱的建站团队

量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决

md5加密vb.net md5加密后是多少位

怎么在.net上实现MD5crypt的加密(最好vb.net代码)

MD5实际一种单向的算法,是散列,很多人认为是加密,实际有误

为新津县等地区用户提供了全套网页设计制作服务,及新津县网站建设行业解决方案。主营业务为成都做网站、网站建设、新津县网站设计,以传统方式定制建设网站,并提供域名空间备案等一条龙服务,秉承以专业、用心的态度为用户提供真诚的服务。我们深信只要达到每一位用户的要求,就会得到认可,从而选择与我们长期合作。这样,我们也可以走得更远!

比如说winxp、win7各版本都有MD5值,那么是否可依据这个值还原出个正版的winxp或win7呢?

况且MD5“加密”的密钥长度又是多少呢?比如des的不同版本有64位、128位、192位等

求md5批量加密的工具,要能保存加密出来的密文,密文与明文对应的....生成数据库也行!

用Replace Pioneer可以实现md5批量加密,假如某文件每行是一个明文,详细步骤:

1. ctrl-o打开文件

2. ctrl-h打开replace窗口

* replace unit选择Line

* replace with pattern输入md5_hex($match)\n

3. 点击Replace,每行生成一个md5密文

4. ctrl-s保存到文件里。

测试结果,明文:

AAAAA

BBBBB

CCCCC

md5加密文本:

f6a6263167c92de8644ac998b3c4e4d1

87c7d4068be07d390a1fffd21bf1e944

e86a1cf0678099986a901c79086f5617

用Replace Pioneer进行加密的例子还有:How to calculate md5 hex value of each line of text file?

VB.NET 获取文件MD5值

Public Function md5(ByVal a As String) As String

Dim tempmd5 As System.Security.Cryptography.MD5 = New System.Security.Cryptography.MD5CryptoServiceProvider()

Dim bytResult() As Byte = tempmd5.ComputeHash(System.Text.Encoding.Default.GetBytes(a))

Dim strResult As String = BitConverter.ToString(bytResult)

strResult = strResult.Replace("-", "")

Return strResult

End Function

如果要计算文件的就把参数改成字节数组就可以了,然后获取文件GetBytes()传进去就可以了。

求VB.NET的MD5算法调用

下面是完整的类,可以设置任意密码

'DES及md5加密解密----添加引用中添加对system.web的引用。

Imports System.Security.Cryptography

Imports System

Imports System.Text

Imports System.Web

''' summary

''' DES加密类

''' /summary

''' remarks/remarks

Public Class DESEncrypt

Public Sub DESEncrypt()

End Sub

Public Shared Function Encrypt(ByVal Text As String) As String

Return Encrypt(Text, "12345678")

End Function

Public Shared Function Encrypt(ByVal Text As String, ByVal sKey As String) As String

Dim des As New 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 New System.IO.MemoryStream()

Dim cs As New CryptoStream(ms, des.CreateEncryptor(), CryptoStreamMode.Write)

cs.Write(inputByteArray, 0, inputByteArray.Length)

cs.FlushFinalBlock()

Dim ret As New StringBuilder()

Dim b As Byte

For Each b In ms.ToArray()

ret.AppendFormat("{0:X2}", b)

Next

Return ret.ToString()

End Function

Public Shared Function Decrypt(ByVal Text As String) As String

Return Decrypt(Text, "12345678")

End Function

Public Shared Function Decrypt(ByVal Text As String, ByVal sKey As String) As String

Dim des As New DESCryptoServiceProvider()

Dim len As Integer

len = Text.Length / 2

Dim inputByteArray(len - 1) As Byte

Dim x, i As Integer

For x = 0 To len - 1

i = Convert.ToInt32(Text.Substring(x * 2, 2), 16)

inputByteArray(x) = CType(i, Byte)

Next

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 New System.IO.MemoryStream()

Dim cs As New CryptoStream(ms, des.CreateDecryptor(), CryptoStreamMode.Write)

cs.Write(inputByteArray, 0, inputByteArray.Length)

cs.FlushFinalBlock()

Return Encoding.Default.GetString(ms.ToArray())

End Function

End Class

'以下是调用方法

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click '加密

Dim str_Encrypt As String = DESEncrypt.Encrypt("你要加密的文本,可以是任意长度", "密码,可以很长,如果省略这个参数就是默认的12345678")

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click '解密

Dim str_Decrypt As String = DESEncrypt.Decrypt("你要解密的文本, 可以是任意长度", "加密时用到的密码,如果省略这个参数就是默认的12345678")

End Sub

vb.net 怎么获取一个文件夹所有文件的MD5值

VB可使用DriveListBox 控件,DirListBox 控件和FileListBox 控件组合使用获取文件夹里的文件数量(包括文件夹)。 DriveListBox 控件 在运行时,由于有 DriveListBox 控件,所以可选择一个有效的磁盘驱动器。

加密解密高手进!VB.NET 谁能给一个MD5或其他的加密算法

这个是我之前写的。在需要时调用即可。

Public Shared Function Encrypt(ByVal Text As String, ByVal sKey As String) As String

Dim provider As New DESCryptoServiceProvider()

Dim bytes As Byte() = Encoding.[Default].GetBytes(Text)

provider.Key = Encoding.ASCII.GetBytes(FormsAuthentication.HashPasswordForStoringInConfigFile(sKey, "md5").Substring(0, 8))

provider.IV = Encoding.ASCII.GetBytes(FormsAuthentication.HashPasswordForStoringInConfigFile(sKey, "md5").Substring(0, 8))

Dim stream As New MemoryStream()

Dim stream2 As New CryptoStream(stream, provider.CreateEncryptor(), CryptoStreamMode.Write)

stream2.Write(bytes, 0, bytes.Length)

stream2.FlushFinalBlock()

Dim builder As New StringBuilder()

For Each num As Byte In stream.ToArray()

builder.AppendFormat("{0:X2}", num)

Next

Return builder.ToString()

End Function

希望能帮到你


网站题目:md5加密vb.net md5加密后是多少位
URL地址:http://6mz.cn/article/hgjdco.html

其他资讯