Windows 8 VB MD5哈希

时间:2012-06-29 10:56:23

标签: windows vb.net md5

您好我正在为Windows 8(metro app)寻找md5哈希函数

我一直在谷歌(和其他搜索引擎)中寻找这个,但是Windows 8没有任何东西,大多数都是关于win 7(或者更老)

谢谢你:)

1 个答案:

答案 0 :(得分:1)

我没有找到MD5,但我发现SHA256这里有一些样品,如果你感兴趣的话;)

Function sha512(Key As String)
    Dim hash As String
    Dim strAlgName As String = "SHA512"
    Dim objAlgProv As HashAlgorithmProvider = HashAlgorithmProvider.OpenAlgorithm(strAlgName)
    Dim objHash As CryptographicHash = objAlgProv.CreateHash()
    Dim buffMsg1 As IBuffer = CryptographicBuffer.ConvertStringToBinary(Key, BinaryStringEncoding.Utf16BE)
    objHash.Append(buffMsg1)
    Dim buffHash1 As IBuffer = objHash.GetValueAndReset()
    Dim strHash1 As String = CryptographicBuffer.EncodeToBase64String(buffHash1)
    hash = strHash1
    Return hash
End Function