I want to encrypt and decrypt the password and username of my login table
I already populate my login table with 5 rows
Can anyone suggest some Encryption and decryption algorithms for Password protection?
here is my current code
Option Strict On
Imports System.Data.SqlClient
Public Class Frmlogin
Private strCon As String = "Data Source=OCHO_CINCO;Initial Catalog=CGHMS;Integrated Security=True"
Dim dept_id As String
Private Sub BtnLogin_Click(sender As Object, e As EventArgs) Handles BtnLogin.Click
Dim cmd As New SqlCommand()
Using con As New SqlConnection(strCon)
con.Open()
cmd.Connection = con
cmd.CommandText = "select log_username, log_password, dept_id from login where log_username = @username And " + "log_password = @password"
cmd.Parameters.AddWithValue("@username", TxtUsername.Text)
cmd.Parameters.AddWithValue("@password", Txtpassword.Text)
Using dr As SqlDataReader = cmd.ExecuteReader()
Dim indicator As Boolean = False
While dr.Read()
Dim mydept As String = dr("dept_id").ToString()
If dr.HasRows AndAlso mydept = "1" Then
MessageBox.Show("Ekurhuleni")
FrmDashBoardMenuDept1.Show()
Me.Hide()
indicator = True
ElseIf dr.HasRows AndAlso mydept = "2" Then
MessageBox.Show("WestRand")
FrmDashBoardMenuDept2.Show()
Me.Hide()
indicator = True
ElseIf dr.HasRows AndAlso mydept = "3" Then
MessageBox.Show("Johannesburg - Head Office")
FrmDashBoardMenuDept3.Show()
Me.Hide()
indicator = True
ElseIf dr.HasRows AndAlso mydept = "4" Then
MessageBox.Show("Gordonia Services")
FrmdashBoardMenuDept4.Show()
Me.Hide()
indicator = True
ElseIf dr.HasRows AndAlso mydept = "5" Then
MessageBox.Show("Tshepong Stimulation Centre")
FrmDashBoardMenuDept5.Show()
Me.Hide()
indicator = True
End If
End While
If Not indicator Then
MessageBox.Show("Invalid User name and password")
End If
End Using
End Using
End Sub