How to make a MD5 Text Encrypter

Heres your chance to share your own tutorials with the community. Just post them on here. If your lucky they may even be posted on the main site.
7 posts Page 1 of 1
Contributors
User avatar
code it
VIP - Site Partner
VIP - Site Partner
Posts: 821
Joined: Sun Oct 10, 2010 3:02 pm

How to make a MD5 Text Encrypter
code it
Make your form like this:
Image


The TextBox beside the button = TextBox1
The Other TextBox is = TextBox2
The Button = Button1,Text = Encrypt

Replace all the code with this code ;D
Code: Select all
Public Class Form1
    Public Shared Function MD5(ByVal Text As String, Optional ByVal Seperator As String = Nothing) As String
        Dim Hash As Byte()
        Dim Encoder As New System.Text.UTF8Encoding()
        Dim Hasher As New System.Security.Cryptography.MD5CryptoServiceProvider()
        Hash = Hasher.ComputeHash(Encoder.GetBytes(Text))
        Text = Replace(BitConverter.ToString(Hash), "-", Seperator)
        Return Text
    End Function

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        TextBox2.Text = MD5(TextBox1.Text)
    End Sub
End Class
Please +rep! cooll;
GoodGuy17
Coding God
Coding God
Posts: 1610
Joined: Mon Sep 07, 2009 12:25 am

Code It, you have excellent code in your tutorials, but what he means is, you should try to explain it better and stretch it out.
User avatar
code it
VIP - Site Partner
VIP - Site Partner
Posts: 821
Joined: Sun Oct 10, 2010 3:02 pm

GoodGuy17 wrote:
Code It, you have excellent code in your tutorials, but what he means is, you should try to explain it better and stretch it out.
I don't know how to say it -.- dunnno;
GoodGuy17
Coding God
Coding God
Posts: 1610
Joined: Mon Sep 07, 2009 12:25 am

Instead of telling us to replace all of the code with *code*, explain each line, and why it works like that. It would help us learn, instead of copy-pasta.
User avatar
Zulf
Serious Programmer
Serious Programmer
Posts: 441
Joined: Fri Jun 11, 2010 7:46 am

Re: How to make a MD5 Text Encrypter
Zulf
Yeah, use a ' after each line of your code to explain what each line means.
Image
User avatar
mandai
Coding God
Coding God
Posts: 2585
Joined: Mon Apr 26, 2010 6:51 pm

Re: How to make a MD5 Text Encrypter
mandai
I can explain this if you want. In short it is just getting the hash as a byte array from MD5CryptoServiceProvider.ComputeHash, then converting it to a string with BitConverter.ToString(). BitConverter adds a - between each byte so this either replaces them with nothing or whatever the user specifies in the function.
User avatar
code it
VIP - Site Partner
VIP - Site Partner
Posts: 821
Joined: Sun Oct 10, 2010 3:02 pm

Re: How to make a MD5 Text Encrypter
code it
GoodGuy17 wrote:
Instead of telling us to replace all of the code with *code*, explain each line, and why it works like that. It would help us learn, instead of copy-pasta.
I will try to explain the code more in another tutorial! cooll;
7 posts Page 1 of 1
Return to “Tutorials”