md5hash + salt methods

Posts 1–8 of 8 · Page 1 of 1
md5hash + salt methods
ok im trying to figure out how to handle the correct methods for md5 hash + salt
i have the salt for each password formated as 5 bytes or characters w/e
i need to take this and somehow convert the md5 with the salt
right now im just using one password trying to get the correct info from it so im doing the following method
Code:
 Private Function GetHashedPassword(ByVal password As String) As String
        Dim salt As String = ";w#nO"
        Dim bytHashedData As Byte()
        Dim encoder As New UTF8Encoding()
        Dim md5Hasher As New MD5CryptoServiceProvider

        Dim passwordBytes As Byte() = Encoding.ASCII.GetBytes(password)
        Dim saltBytes As Byte() = encoder.GetBytes(salt)

        Dim passwordAndSaltBytes As Byte() = _
        New Byte(passwordBytes.Length + saltBytes.Length - 1) {}

        For i As Integer = 0 To passwordBytes.Length - 1
            passwordAndSaltBytes(i) = passwordBytes(i)
        Next

        For i As Integer = 0 To saltBytes.Length - 1
            passwordAndSaltBytes(i + passwordBytes.Length) = saltBytes(i)
        Next

        bytHashedData = md5Hasher.ComputeHash(passwordAndSaltBytes)

        Dim hashValue As String
        hashValue = Convert.ToBase64String(saltBytes)

        Return hashValue
    End Function
if i convert it using md5 first I get ' vcyAp/w0owFSLj8+BRYtwQ==" which is no whers near right
it needs to show up as "bdf4a74bb6042a4174ee369ba992c4ca"
if i dont convert to Md5 first it gives me ""JVG9ewOtSR3X1aSAa4Du1w==" Which still isnt right

can anyone help with this. im stuck and confused.
Quote Originally Posted by XiAtomikiX View Post
ok im trying to figure out how to handle the correct methods for md5 hash + salt
i have the salt for each password formated as 5 bytes or characters w/e
i need to take this and somehow convert the md5 with the salt
right now im just using one password trying to get the correct info from it so im doing the following method
Code:
 Private Function GetHashedPassword(ByVal password As String) As String
        Dim salt As String = ";w#nO"
        Dim bytHashedData As Byte()
        Dim encoder As New UTF8Encoding()
        Dim md5Hasher As New MD5CryptoServiceProvider

        Dim passwordBytes As Byte() = Encoding.ASCII.GetBytes(password)
        Dim saltBytes As Byte() = encoder.GetBytes(salt)

        Dim passwordAndSaltBytes As Byte() = _
        New Byte(passwordBytes.Length + saltBytes.Length - 1) {}

        For i As Integer = 0 To passwordBytes.Length - 1
            passwordAndSaltBytes(i) = passwordBytes(i)
        Next

        For i As Integer = 0 To saltBytes.Length - 1
            passwordAndSaltBytes(i + passwordBytes.Length) = saltBytes(i)
        Next

        bytHashedData = md5Hasher.ComputeHash(passwordAndSaltBytes)

        Dim hashValue As String
        hashValue = Convert.ToBase64String(saltBytes)

        Return hashValue
    End Function
if i convert it using md5 first I get ' vcyAp/w0owFSLj8+BRYtwQ==" which is no whers near right
it needs to show up as "bdf4a74bb6042a4174ee369ba992c4ca"
if i dont convert to Md5 first it gives me ""JVG9ewOtSR3X1aSAa4Du1w==" Which still isnt right

can anyone help with this. im stuck and confused.
Are you trying to combine it or do one step, and then the other?
Quote Originally Posted by DawgiiStylz View Post


Are you trying to combine it or do one step, and then the other?
well i have the md5 using another method so i want to take the md5 and add the salt of ";w#nO"

---------- Post added at 06:07 PM ---------- Previous post was at 05:53 PM ----------

Quote Originally Posted by XiAtomikiX View Post
well i have the md5 using another method so i want to take the md5 and add the salt of ";w#nO"
i beleive the byte method should be 33,126 which would return 93 if im correct
You're over thinking it. Here's my method for md5 hashing:
Code:
Function getMD5Hash(ByVal strToHash As String) As String
        Dim md5Obj As New MD5CryptoServiceProvider
        Dim bytesToHash() As Byte = System.Text.Encoding.ASCII.GetBytes(strToHash)
        bytesToHash = md5Obj.ComputeHash(bytesToHash)
        Dim strResult As String = ""
        For Each b As Byte In bytesToHash
            strResult += b.ToString("x2")
        Next
        Return strResult
    End Function
then you invoke the function like such:
Code:
sub fuckItThisIsWhatEver()
dim string1 as string = "PENIS"
dim salt as string = ";w#nO"
dim string2 as string = getMD5Hash(password & salt)
end sub
Quote Originally Posted by LilGho$t View Post
You're over thinking it. Here's my method for md5 hashing:
Code:
Function getMD5Hash(ByVal strToHash As String) As String
        Dim md5Obj As New MD5CryptoServiceProvider
        Dim bytesToHash() As Byte = System.Text.Encoding.ASCII.GetBytes(strToHash)
        bytesToHash = md5Obj.ComputeHash(bytesToHash)
        Dim strResult As String = ""
        For Each b As Byte In bytesToHash
            strResult += b.ToString("x2")
        Next
        Return strResult
    End Function
then you invoke the function like such:
Code:
sub fuckItThisIsWhatEver()
dim string1 as string = "PENIS"
dim salt as string = ";w#nO"
dim string2 as string = getMD5Hash(password & salt)
end sub
Mines a lot like that, but slightly different on the string2
Mine would be
Code:
sub fuckItThisIsWhatEver()
dim string1 as string = getMD5Hash("PENIS")
dim salt as string = getMD5Hash(";w#nO")
dim string2 as string = getMD5Hash(password & salt)
end sub
OR in most cases would just be
Code:
dim string2 as string = getMD5Hash(getMD5Hash("PENIS") & getMD5Hash(";w#nO"))
Quote Originally Posted by rileyjstrickland View Post
Mines a lot like that, but slightly different on the string2
Mine would be
Code:
sub fuckItThisIsWhatEver()
dim string1 as string = getMD5Hash("PENIS")
dim salt as string = getMD5Hash(";w#nO")
dim string2 as string = getMD5Hash(password & salt)
end sub
OR in most cases would just be
Code:
dim string2 as string = getMD5Hash(getMD5Hash("PENIS") & getMD5Hash(";w#nO"))
the issue with that is your salting with a hash. Typically, as far as i understand, you salt with a plain string not with another salt. In my method i'm saying, "Make these 2 things the same string, then get the md5 hash of that combined string."
Quote Originally Posted by LilGho$t View Post
the issue with that is your salting with a hash. Typically, as far as i understand, you salt with a plain string not with another salt. In my method i'm saying, "Make these 2 things the same string, then get the md5 hash of that combined string."
I store unique salts for each of my users. Also hashing the salt and password, then hashing again makes the entire account just *that* much more secure.
Quote Originally Posted by rileyjstrickland View Post
I store unique salts for each of my users. Also hashing the salt and password, then hashing again makes the entire account just *that* much more secure.
Lol here's my security:
1. Get the md5 hash of a few unique pc things (hwid, mac address, etc.) & a salt
2. Smash that md5 hash up with the username & password a user entered
3. Decipher an online file to just the md5 hashes of the username, pw & pcCodeHash
4. Check to make sure the user is truly a valid user
5. If the user is valid, yay unlock. Else, lock dat bitch out.
Posts 1–8 of 8 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us