Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27156

VS 2012 MD5 Hash of an Object

$
0
0
Is it possible to get an MD5 Hash of an Object.

Here is my code:

Code:

    Public Function MD5CalcObject(ByVal ObjectToCheck As Object) As String
        Try
            Using md5 As New System.Security.Cryptography.MD5CryptoServiceProvider

                Dim hash() As Byte = md5.ComputeHash(ObjectToCheck) 'Error is here
                Return ByteArrayToString(hash)
            End Using
        Catch Exception As Exception
            MessageBox.Show(Exception.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End Try
    End Function

Or does the Object.GetHashCode() method basically do this?

Viewing all articles
Browse latest Browse all 27156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>