Author

Topic: Very simple and useless encryption/decryption in vb.net! Source included (Read 2936 times)

sr. member
Activity: 392
Merit: 250


binary: www(dot)mediafire(dot)com/download/pr7f00rz874x82c/CryptEX.exe

Pretty useless, but i thought i would share:)








Code:
Imports System.Security.Cryptography
Imports System.Text
Imports Microsoft.VisualBasic

Public Class Form1

    Private Shared 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()
        For i As Integer = 0 To data.Length - 1
            sBuilder.Append(data(i).ToString("x2"))
        Next i
        Return sBuilder.ToString()
    End Function
    Public Shared Function CompareThem(ByVal hashedStr As String, ByVal str As String) As Boolean
        Dim md5hash As MD5 = MD5.Create()
        Dim comparer As StringComparer = StringComparer.OrdinalIgnoreCase
        If comparer.Compare(hashedStr, GetMD5Hash(md5hash, str)) = 0 Then
            Return True
        Else
            Return False
        End If
    End Function

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Timer1.Start()

    End Sub

    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        If RadioButton1.Checked Then Label1.Text = "MD5"
        If RadioButton1.Checked Then Button2.Enabled = False
        If RadioButton2.Checked Then Label1.Text = "BASE64"
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        If RadioButton1.Checked Then
            Dim input As String
            input = TextBox1.Text
            Dim hash As String = ""
            Using md5hash As MD5 = MD5.Create()
                hash = GetMD5Hash(md5hash, Input)
            End Using
            TextBox2.Text = hash
        End If
        If RadioButton2.Checked Then
            Dim base64Decoded As String = TextBox1.Text
            Dim base64Encoded As String
            Dim data As Byte()
            data = System.Text.ASCIIEncoding.ASCII.GetBytes(base64Decoded)
            base64Encoded = System.Convert.ToBase64String(data)
            TextBox2.Text = base64Encoded

        End If

    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        If RadioButton2.Checked = True Then
            Dim base64Encoded As String = TextBox1.Text
            Dim base64Decoded As String
            Dim data() As Byte
            data = System.Convert.FromBase64String(base64Encoded)
            base64Decoded = System.Text.ASCIIEncoding.ASCII.GetString(data)
            TextBox2.Text = base64Decoded

        End If
    End Sub
End Class
I wonder why you give the software such a terrible title Very simple and useless encryption/decryption in vb.net! it could useful someday, just keep it.
sr. member
Activity: 392
Merit: 268
Tips welcomed: 1CF4GhXX1RhCaGzWztgE1YZZUcSpoqTbsJ
This is neither encryption nor decryption. MD5 is a (crappy) hashing method, Base64 is an encoding method that is not designed to be secure against eavesdropping (but rather, as a way to prevent corruption by some mailservers that messed with non-text characters).
hero member
Activity: 686
Merit: 500
Cool, i give it a try sometimes some of the simple software out there gets a bad rep just because is not backed by someone or a community is up to users to give some exposure not every will find it useless but for some it will work.
newbie
Activity: 41
Merit: 0
https://i.imgur.com/xSeD9vq.png

binary: www(dot)mediafire(dot)com/download/pr7f00rz874x82c/CryptEX.exe

Pretty useless, but i thought i would share:)








Code:
Imports System.Security.Cryptography
Imports System.Text
Imports Microsoft.VisualBasic

Public Class Form1

    Private Shared 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()
        For i As Integer = 0 To data.Length - 1
            sBuilder.Append(data(i).ToString("x2"))
        Next i
        Return sBuilder.ToString()
    End Function
    Public Shared Function CompareThem(ByVal hashedStr As String, ByVal str As String) As Boolean
        Dim md5hash As MD5 = MD5.Create()
        Dim comparer As StringComparer = StringComparer.OrdinalIgnoreCase
        If comparer.Compare(hashedStr, GetMD5Hash(md5hash, str)) = 0 Then
            Return True
        Else
            Return False
        End If
    End Function

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Timer1.Start()

    End Sub

    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        If RadioButton1.Checked Then Label1.Text = "MD5"
        If RadioButton1.Checked Then Button2.Enabled = False
        If RadioButton2.Checked Then Label1.Text = "BASE64"
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        If RadioButton1.Checked Then
            Dim input As String
            input = TextBox1.Text
            Dim hash As String = ""
            Using md5hash As MD5 = MD5.Create()
                hash = GetMD5Hash(md5hash, Input)
            End Using
            TextBox2.Text = hash
        End If
        If RadioButton2.Checked Then
            Dim base64Decoded As String = TextBox1.Text
            Dim base64Encoded As String
            Dim data As Byte()
            data = System.Text.ASCIIEncoding.ASCII.GetBytes(base64Decoded)
            base64Encoded = System.Convert.ToBase64String(data)
            TextBox2.Text = base64Encoded

        End If

    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        If RadioButton2.Checked = True Then
            Dim base64Encoded As String = TextBox1.Text
            Dim base64Decoded As String
            Dim data() As Byte
            data = System.Convert.FromBase64String(base64Encoded)
            base64Decoded = System.Text.ASCIIEncoding.ASCII.GetString(data)
            TextBox2.Text = base64Decoded

        End If
    End Sub
End Class
Jump to: