Cryptology the study of codes, or the art of writing and solving them. it is a mathematics such as number theory, application of algorithms that building cryptography and cryptanalysis.
Cryptanalysis is the study of analyzing information in order to study the hidden aspects of the system, it is used to breach security system and access to the contents, even if the cryptographic key is undefined. The concepts are complex and high specialized.
Syntax
Imports System Imports System.Security.Cryptography Imports System.Text Public Class Form1 Function GetMd5Hash(ByVal md5Hash As MD5, ByVal input As String) As String Dim data As Byte() = md5Hash.ComputeHash(Encoding.UTF8.GetBytes(input)) Dim sBuilder As New StringBuilder() Dim i As Integer For i = 0 To data.Length - 1 sBuilder.Append(data(i).ToString("x2")) Next i Return sBuilder.ToString() End Function Function VerifyMd5Hash(ByVal md5Hash As MD5, ByVal input As String, ByVal hash As String) As Boolean Dim hashOfInput As String = GetMd5Hash(md5Hash, input) Dim comparer As StringComparer = StringComparer.OrdinalIgnoreCase If 0 = comparer.Compare(hashOfInput, hash) Then Return True Else Return False End If End Function Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim [source] As String = TextBox1.Text Using md5Hash As MD5 = MD5.Create() Dim hash As String = GetMd5Hash(md5Hash, source) Label2.Text = hash If VerifyMd5Hash(md5Hash, [source], hash) Then MsgBox("The result are same.", MsgBoxStyle.Information, "MD5 Hash Generator") Else MsgBox("The result are not same.", MsgBoxStyle.Critical, "MD5 Hash Generator") End If End Using End Sub End Class
No comments:
Post a Comment