Bitcoin Forum
June 21, 2021, 06:38:04 PM *
News: Latest Bitcoin Core release: 0.21.1 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Very simple and useless encryption/decryption in vb.net! Source included  (Read 2896 times)
Alex1212
Newbie
*
Offline Offline

Activity: 41
Merit: 0


View Profile
July 04, 2015, 03:14:32 PM
 #1

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
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
scarsbergholden
Hero Member
*****
Offline Offline

Activity: 686
Merit: 500



View Profile
July 04, 2015, 05:04:41 PM
 #2

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.

hexafraction
Sr. Member
****
Offline Offline

Activity: 392
Merit: 250

Tips welcomed: 1CF4GhXX1RhCaGzWztgE1YZZUcSpoqTbsJ


View Profile
July 04, 2015, 07:22:45 PM
 #3

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).

I have recently become active again after a long period of inactivity. Cryptographic proof that my account has not been compromised is available.
noel57
Sr. Member
****
Offline Offline

Activity: 392
Merit: 250



View Profile
July 05, 2015, 05:15:43 AM
 #4



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.

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!