[TUT]Basic Encrypter\Decrypter

Posts 1–15 of 31 · Page 1 of 3
[TUT]Basic Encrypter\Decrypter
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
Quick Encrypt.rarattachment deleted · 75 downloads before removal
That is actually really awesome, did you write that yourself?

If so, bravo.


^That's for you^
Quote Originally Posted by Lolland View Post
That is actually really awesome, did you write that yourself?

If so, bravo.


^That's for you^
Thanks bro haha and yes i wrote it myself
Quote Originally Posted by Bombsaway707 View Post
Thanks bro haha and yes i wrote it myself
I hate when people say they made it when they just copy past and take credits!

Quote Originally Posted by XGelite View Post
.............................
u sure he C&P?
Yeah almost
Seems good, I will try this when I wake up
You are the best VB coder I've ever seen. You deserve a whole lot more cookies than I gave you
Quote Originally Posted by Lolland View Post
You are the best VB coder I've ever seen. You deserve a whole lot more cookies than I gave you
Haha thanks But dont doubt yourself, your a pretty good coder to
Not as godly as you
Quote Originally Posted by Lolland View Post
Not as godly as you
haha thanks man btw Did you get it to work?
wow A+ job man.
Quote Originally Posted by Zoom View Post
Yeah almost
I didnt copy and paste. This is my code i posted it on a VB.net site in january of 2009. this guy mustv'e taken my code and made a video on it. I have had the code on my PC and never thought to release on MPGH. If you dont believe me look at the attachement to my thread. It is the original encryptor/decryptor. It is much more advanced then the one in the video and the one i posted for you guys to make. Also listen to the kid, hes probably 12 years old do u think he could come up with this advanced of code?
yeahh.. looks great
Posts 1–15 of 31 · Page 1 of 3
This thread is closed for replies.

Similar Threads

Tags for this Thread

Talk with us