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:
Code:
Imports System.Security.Cryptography
Next we need to Dimension some variables:
Code:
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
Code:
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.
Bookmarks