1. Create a new project
2. Add 2 textboxes. Textbox1 being single lined and textbox2 being multiline
3. Add 2 buttons. Button1 text being encrypt and button2 text being decrypt
4. Go into the coding. Unde public class form 1 put-
Code:
Dim DES AsNew System.Security.Cryptography.TripleDESCryptoServiceProvider
Dim Hash AsNew System.Security.Cryptography.MD5CryptoServiceProvider
5. Under button1(encrypt) click put-
Code:
Try
DES.Key = Hash.ComputeHash(System.Text.ASCIIEncoding.ASCII.GetBytes(TextBox1.Text))
DES.Mode = Security.Cryptography.CipherMode.ECB
Dim DESEncrypter As System.Security.Cryptography.ICryptoTransform = DES.CreateEncryptor
Dim Buffer AsByte() = System.Text.ASCIIEncoding.ASCII.GetBytes(TextBox2.Text)
TextBox2.Text = Convert.ToBase64String(DESEncrypter.TransformFinalBlock(Buffer, 0, Buffer.Length))
Catch ex As Exception
MessageBox.Show("The following error(s) have occurred: " & ex.Message, Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Error)
EndTry
6. Under Button 2(decrypt) put-
Code:
Try
DES.Key = Hash.ComputeHash(System.Text.ASCIIEncoding.ASCII.GetBytes(TextBox1.Text))
DES.Mode = Security.Cryptography.CipherMode.ECB
Dim DESDecrypter As System.Security.Cryptography.ICryptoTransform = DES.CreateDecryptor
Dim Buffer AsByte() = Convert.FromBase64String(TextBox2.Text)
TextBox2.Text = System.Text.ASCIIEncoding.ASCII.GetString(DESDecrypter.TransformFinalBlock(Buffer, 0, Buffer.Length))
Catch ex As Exception
MessageBox.Show("The following error(s) have occurred: " & ex.Message, Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Error)
EndTry
Now how to use this. Textbox1 is like an encryption key. To decrypt a message it must be the same key as used originally Ex:
If you put 1337 in textbox 1 and put Hai! in textbox2 if you put 1336 in textbox1 and try to decrypt textbox2 it will give you an error.
So Textbox1 is the encryption key, and textbox2 is the message to encrypt/encrypted message
For you lazy people heres da full code:
Code:
PublicClass Form1
Dim DES AsNew System.Security.Cryptography.TripleDESCryptoServiceProvider
Dim Hash AsNew System.Security.Cryptography.MD5CryptoServiceProvider
PrivateSub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load
EndSub
PrivateSub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Try
DES.Key = Hash.ComputeHash(System.Text.ASCIIEncoding.ASCII.GetBytes(TextBox1.Text))
DES.Mode = Security.Cryptography.CipherMode.ECB
Dim DESDecrypter As System.Security.Cryptography.ICryptoTransform = DES.CreateDecryptor
Dim Buffer AsByte() = Convert.FromBase64String(TextBox2.Text)
TextBox2.Text = System.Text.ASCIIEncoding.ASCII.GetString(DESDecrypter.TransformFinalBlock(Buffer, 0, Buffer.Length))
Catch ex As Exception
MessageBox.Show("The following error(s) have occurred: " & ex.Message, Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Error)
EndTry
EndSub
PrivateSub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
DES.Key = Hash.ComputeHash(System.Text.ASCIIEncoding.ASCII.GetBytes(TextBox1.Text))
DES.Mode = Security.Cryptography.CipherMode.ECB
Dim DESEncrypter As System.Security.Cryptography.ICryptoTransform = DES.CreateEncryptor
Dim Buffer AsByte() = System.Text.ASCIIEncoding.ASCII.GetBytes(TextBox2.Text)
TextBox2.Text = Convert.ToBase64String(DESEncrypter.TransformFinalBlock(Buffer, 0, Buffer.Length))
Catch ex As Exception
MessageBox.Show("The following error(s) have occurred: " & ex.Message, Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Error)
EndTry
EndSub
EndClass
I attached my version of it. Here is the virus scans --> VirusTotal, VirScan
For those of you who think i C&P *cough*hesjan*cough* i dindt look at the attachment its my original encryptor/decryptor made in january of '09. Plus the british kid sounds like hes 11