2012-06-29 159 views
0

你好,我是在尋找適用於Windows 8(Metro應用)Windows 8的VB MD5哈希

我在谷歌一直在尋找這樣一個MD5哈希函數(和其他搜索引擎),但並沒有什麼針對Windows 8,其中大部分是關於勝7(或以上)

謝謝任何​​方式:)

+0

可能有[Comput在C#中Metro風格的應用程序的MD5](http://stackoverflow.com/questions/8297627/compute-md5-on-metro-style-app-in-c-sharp) - 這應該適用於VB.NET作爲好,除了小的語法差異之外。 – Joey

+0

但它甚至沒有回答! 我現在可以在Windows 8上找到任何類型的哈希值! 「Windows.Security.Cryptography.Certificates」沒有散列屬性:S –

+0

如果爲了安全起見,請注意MD5不是非常安全。 – jmoreno

回答

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