[VB.NET] Not enough chars in SHA512 string

Discussion in 'Mixed Languages' started by Stannieman, Mar 28, 2011.

  1. Stannieman

    Stannieman MDL Guru

    Sep 4, 2009
    2,232
    1,818
    90
    #1 Stannieman, Mar 28, 2011
    Last edited by a moderator: Apr 20, 2017
    I'm trying to hash some data and bumped into a problem.
    Code:
    Dim SHA512 As New SHA512CryptoServiceProvider
    Dim arrSHA512() As Byte
    arrSHA512 = SHA512.ComputeHash(arrData)
    Dim strSHA512Hex As String
    For Each bytArrSHA512Element In arrSHA512
      strSHA512Hex += Conversion.Hex(bytArrSHA512Element)
    Next
    arrSHA512 has 64 elements, which is correct.
    strSHA512Hex, witch is arrSHA512 converted to hex, only has 124 chars however, this should be 128.
    Any ideas why 2 bytes just seem to disappear?

    Thanks
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...