Post: [VB.net] MD5 Encryption
10-07-2011, 08:14 AM #1
Default Avatar
Oneup
Guest
(adsbygoogle = window.adsbygoogle || []).push({}); Well I have been working on a project for work and I realized that I had to use some sort of encryption for passwords when an administrator creates an account. So I turned to MD5 since it was really the first thing that popped into my head.

Funny thing is it's so simple to do and in this topic I'll cover encrypting and authenticating.

So you need to make an import statement for cryptography:

    Imports System.Security.Cryptography


Next we need to Dimension some variables:

    

Dim md5Hasher As New MD5CryptoServiceProvider()

Dim hashedPassword As Byte()

Dim encoder As New UTF8Encoding()



This next chunk will actually salt the password. Now I used a static string for salting, normally you would using something like a login or even their ID

    hashedBytes = md5Hasher.ComputeHash(encoder.GetBytes(txt_password.Text & "idk"))


And that's all there is to encrypting a password. Now to authenticate it you basically run through the encryption again and do a string comparison. If they are the same you can continue on, if not go back and start over. This was mainly done for a web app I am doing and alot of it I can't exactly post.

The following 4 users say thank you to Oneup for this useful post:

One, Epic?, KilllerPanda, Pichu
10-08-2011, 06:09 PM #2
Pichu
RIP PICHU.
Pictures or a video usually helps "Teh Noobs".
10-08-2011, 06:12 PM #3
Default Avatar
Cammy
Guest
Originally posted by Sublimity View Post
Pictures or a video usually helps "Teh Noobs".


The fact he didn't do that really merits a groan?
10-08-2011, 06:15 PM #4
Pichu
RIP PICHU.
Originally posted by Cammmmy View Post
The fact he didn't do that really merits a groan?


Oops, ugh, I meant a thanks... (I'm still waking up...lol).

The following user thanked Pichu for this useful post:

10-08-2011, 08:07 PM #5
Default Avatar
Oneup
Guest
Originally posted by Sublimity View Post
Pictures or a video usually helps "Teh Noobs".


I usually don't go the extra mile because of children like:

Originally posted by another user
The Following User Groaned At 1_UP For This Awful Post:

Epic? (Yesterday)



Be one thing if he actually made a comment in the thread but I guess he just is butt hurt over everything
10-08-2011, 08:33 PM #6
Epic?
Awe-Inspiring
Originally posted by UP View Post
I usually don't go the extra mile because of children like:



Be one thing if he actually made a comment in the thread but I guess he just is butt hurt over everything


Congratulations! You created an incredibly simple and barely useful tutorial that doesn't actually teach anyone how to properly store or handle a salt or a password, that uses an insecure hashing function in a retarded language! Good for you!

However, your post is actually well written, and your code looks like it will at least run, so I'll change my groan to a thank, but it sounds like you were the one with the butt hurt! Seriously, people cry every time they get a groan, I don't think it still removes rep, but then again, even if it did, I don't see why people care about that either.
Last edited by Epic? ; 10-08-2011 at 08:36 PM.
10-08-2011, 08:41 PM #7
Default Avatar
Oneup
Guest
Originally posted by Epic
Congratulations! You created an incredibly simple and barely useful tutorial that doesn't actually teach anyone how to properly store or handle a salt or a password, that uses an insecure hashing function in a retarded language! Good for you!

However, your post is actually well written, and your code looks like it will at least run, so I'll change my groan to a thank, but it sounds like you were the one with the butt hurt! Seriously, people cry every time they get a groan, I don't think it still removes rep, but then again, even if it did, I don't see why people care about that either.


Actually it's not even that, if you plan on doing that dont be a pussy and actually state why. Otherwise you just look like some kid going around downing threads for no reason. Like it or not but unless you are working in the field, VB.net and C# are bigger then you would think. Simply because of it being simplistic and having the ability to roll out applications faster then it would be to have someone actually build everything. But dont groan on a thread simply because you dont like the language. Like it or not it's used and any site you see with the .aspx extension , either using VB or C#

The following user thanked Oneup for this useful post:

MrRa1n
10-08-2011, 08:56 PM #8
Pichu
RIP PICHU.
Originally posted by UP View Post
Actually it's not even that, if you plan on doing that dont be a pussy and actually state why. Otherwise you just look like some kid going around downing threads for no reason. Like it or not but unless you are working in the field, VB.net and C# are bigger then you would think. Simply because of it being simplistic and having the ability to roll out applications faster then it would be to have someone actually build everything. But dont groan on a thread simply because you dont like the language. Like it or not it's used and any site you see with the .aspx extension , either using VB or C#


Look, I am working in the field of C#, honestly VB.Net takes up too much resources from the computer and what you can do with it is limited compared to C#. Eventually, I'm getting the hell away from C# and moving towards C++ (The mother language I wish to master).

The only reason why i would use C# after I convert is for XNA.

Besides, I am going to say this, EPIC? knows a whole hell of a lot more then both of us, although I would most likely say I know a more than you in this field.

The following user thanked Pichu for this useful post:

Docko412
10-09-2011, 04:18 AM #9
Default Avatar
Oneup
Guest
Originally posted by Sublimity View Post
Look, I am working in the field of C#, honestly VB.Net takes up too much resources from the computer and what you can do with it is limited compared to C#. Eventually, I'm getting the hell away from C# and moving towards C++ (The mother language I wish to master).

The only reason why i would use C# after I convert is for XNA.

Besides, I am going to say this, EPIC? knows a whole hell of a lot more then both of us, although I would most likely say I know a more than you in this field.


Uh everything that you are able to do in C# is seriously exactly the same in vb (granted the way it's written is a little different, like if's and switches) (aside from the whole XNA thing), it's all on the framework and neither one handles anything any better. I've been doing php and asp.net for a few years now as well as Point of sales software and RFID readers, all done in either language, and like I said. None handle either task any better then the other.
10-09-2011, 09:20 AM #10
Originally posted by UP View Post
Uh everything that you are able to do in C# is seriously exactly the same in vb (granted the way it's written is a little different, like if's and switches) (aside from the whole XNA thing), it's all on the framework and neither one handles anything any better. I've been doing php and asp.net for a few years now as well as Point of sales software and RFID readers, all done in either language, and like I said. None handle either task any better then the other.


ummmm, lol? c# is better, the fact you can do everything vb does+ more.
vb is a decent language, if your trying to make a calculator or maybe a ffviewer(case in point sublimity's black ops calculator & the xboxx ffviewer made by prasoc) both were coded in vb and both are good programs
but as most people do once mastering a simple language they want to move on, and that usually leads them to the c family of programming. wow off topic much. lol anyway.
the point is, c# will always be the big brother of vb and c & c++ will be the mom and dad with python & java as the creepy uncles who touch you when compiling.

Copyright © 2025, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo