7 Replies - 752 Views - Last Post: 15 October 2013 - 07:28 AM Rate Topic: -----

#1 ISameDong  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 5
  • Joined: 13-October 13

Project Login Vb.Net Forn Password Md5 Connect With Sql

Posted 13 October 2013 - 08:11 PM

Posted Image

It can not have access to password md5.
Help me to access the password md5.

Imports System.Security.Cryptography
Imports System.Text
Imports System.Data
Imports MySql.Data.MySqlClient
Public Class frmLogin
  Public Function MD5(ByVal strString As String) As String
        Dim ASCIIenc As New ASCIIEncoding
        Dim strReturn As String
        Dim ByteSourceText() As Byte = ASCIIenc.GetBytes(strString)
        Dim Md5Hash As New MD5CryptoServiceProvider
        Dim ByteHash() As Byte = Md5Hash.ComputeHash(ByteSourceText)

        strReturn = ""

        For Each b As Byte In ByteHash
            strReturn = strReturn & b.ToString("x2")
        Next
        Return strReturn
    End Function





    Private Sub btnLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogin.Click
        Dim objConn As New MySqlConnection
        Dim objCmd As New MySqlCommand
        Dim dtAdapter As New MySqlDataAdapter

        Dim ds As New DataSet
        Dim dt As DataTable
        Dim strConnString, strSQL As String

        strConnString = "Server=--;User Id=hpjobcom; Password=--; Database=hpjobcom_grean; Pooling=false"
        strSQL = "SELECT * FROM members WHERE members_l_username = '" & Me.members_l_username.Text & "' AND members_pass_hash = '" & Me.members_pass_hash.Text & "' "

        objConn.ConnectionString = strConnString
        With objCmd
            .Connection = objConn
            .CommandText = strSQL
            .CommandType = CommandType.Text
        End With
        dtAdapter.SelectCommand = objCmd

        dtAdapter.Fill(ds)
        dt = ds.Tables(0)



        If dt.Rows.Count > 0 Then
            If dt.Rows(0)("Status").ToString.ToLower.Equals("member_group_id") Then

                MsgBox("Wellcome VIP member")
                'Form3.Show()
            Else
                MsgBox("Wellcome User Member")
                'Form2.Show()
                Me.Hide()

            End If

        Else
            MsgBox("Username or Password Incorrect")

        End If




        dtAdapter = Nothing
        objConn.Close()
        objConn = Nothing


    End Sub




    Private Sub frmLogin_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load


    End Sub


End Class




Is This A Good Question/Topic? 0
  • +

Replies To: Project Login Vb.Net Forn Password Md5 Connect With Sql

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9195
  • View blog
  • Posts: 34,517
  • Joined: 12-June 08

Re: Project Login Vb.Net Forn Password Md5 Connect With Sql

Posted 13 October 2013 - 08:13 PM

Huh?
Was This Post Helpful? 0
  • +
  • -

#3 jimzcoder  Icon User is online

  • D.I.C Regular

Reputation: 54
  • View blog
  • Posts: 331
  • Joined: 14-November 12

Re: Project Login Vb.Net Forn Password Md5 Connect With Sql

Posted 13 October 2013 - 08:24 PM

what are you trying to do?. you have created a function but i dont see any line of your code that calls it.
and please be more specific about the problem.

Quote

It can not have access to password md5.
Help me to access the password md5.


yeah sure. we are here to help, but you must provide more information about what you are trying to do and what are the errors that you may have encountered.
Was This Post Helpful? 0
  • +
  • -

#4 ISameDong  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 5
  • Joined: 13-October 13

Re: Project Login Vb.Net Forn Password Md5 Connect With Sql

Posted 15 October 2013 - 04:43 AM

View Postjimzcoder, on 13 October 2013 - 08:24 PM, said:

what are you trying to do?. you have created a function but i dont see any line of your code that calls it.
and please be more specific about the problem.

Quote

It can not have access to password md5.
Help me to access the password md5.


yeah sure. we are here to help, but you must provide more information about what you are trying to do and what are the errors that you may have encountered.

Access password md5, mysql.
Was This Post Helpful? -1
  • +
  • -

#5 Atli  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3718
  • View blog
  • Posts: 5,990
  • Joined: 08-June 10

Re: Project Login Vb.Net Forn Password Md5 Connect With Sql

Posted 15 October 2013 - 04:57 AM

That's not "more information", just a repeat of the limited info you already provided.

If this is just about hashing the password before trying to compare it, then I don't get the problem. You already seem to have a MD5 hashing function, so all you'd need to do is actually use it on the password input before adding it to the SQL query.

P.S.
MD5 is a very weak algorithm and has no business being used for password hashing. Especially unsalted. I suggest you look up algorithms like Bcrypt, or at the very least one of the SHA2 variants.
Was This Post Helpful? 0
  • +
  • -

#6 ISameDong  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 5
  • Joined: 13-October 13

Re: Project Login Vb.Net Forn Password Md5 Connect With Sql

Posted 15 October 2013 - 07:17 AM

Recommend a solution for me.

Imports System.Data
Imports MySql.Data.MySqlClient
Imports System.Security.Cryptography
Imports System.Text
Public Class frmLogin


    
    Private Function GenerateHash(ByVal SourceText As String) As String
        'Create an encoding object to ensure the encoding standard for the source text
        Dim Ue As New UnicodeEncoding()
        'Retrieve a byte array based on the source text
        Dim ByteSourceText() As Byte = Ue.GetBytes(SourceText)
        'Instantiate an MD5 Provider object
        Dim Md5 As New MD5CryptoServiceProvider()
        'Compute the hash value from the source
        Dim ByteHash() As Byte = Md5.ComputeHash(ByteSourceText)
        'And convert it to String format for return
        Return Convert.ToBase64String(ByteHash)
    End Function


           









    Private Sub btnLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogin.Click
        Dim objConn As New MySqlConnection
        Dim objCmd As New MySqlCommand
        Dim dtAdapter As New MySqlDataAdapter

        Dim ds As New DataSet
        Dim dt As DataTable
        Dim strConnString, strSQL As String

        strConnString = "Server=dekgrean.tk;User Id=-; Password=-; Database=hpjobcom_grean; Pooling=false"
        strSQL = "SELECT * FROM members WHERE members_display_name = '" & Me.members_display_name.Text & "' AND members_pass_hash = '" & GenerateHash(Me.members_pass_hash.Text) & "' "

        objConn.ConnectionString = strConnString
        With objCmd
            .Connection = objConn
            .CommandText = strSQL
            .CommandType = CommandType.Text
        End With
        dtAdapter.SelectCommand = objCmd

        dtAdapter.Fill(ds)
        dt = ds.Tables(0)



        If dt.Rows.Count > 0 Then
            If dt.Rows(0)("Status").ToString.ToLower.Equals("vip") Then

                MsgBox("Wellcome VIP member")

            Else
                MsgBox("Wellcome User Member")

                Me.Hide()

            End If

        Else
            MsgBox("Username or Password Incorrect")

        End If




        dtAdapter = Nothing
        objConn.Close()
        objConn = Nothing


    End Sub



End Class




Md5 can not be converted or not ?
Was This Post Helpful? 0
  • +
  • -

#7 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9195
  • View blog
  • Posts: 34,517
  • Joined: 12-June 08

Re: Project Login Vb.Net Forn Password Md5 Connect With Sql

Posted 15 October 2013 - 07:23 AM

Do not open duplicate topics. Merging.
Was This Post Helpful? 0
  • +
  • -

#8 ISameDong  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 5
  • Joined: 13-October 13

Re: Project Login Vb.Net Forn Password Md5 Connect With Sql

Posted 15 October 2013 - 07:28 AM

View Postmodi123_1, on 15 October 2013 - 07:23 AM, said:

Do not open duplicate topics. Merging.

sorry
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1