Original Code:
Code: Select all
Public Function PasswordHash()
'Declarations
Dim strInputString, strCode As String
Dim intNameLength, intRnd As Integer
strInputString = "abcdef0123456789" 'Characters to choose from to generate random string
intNameLength = 16 'Define length of random string
Randomize()
'Generate the random string
For intStep = 1 To intNameLength
intRnd = Int((strInputString.Length * Rnd()) + 1)
strCode = strCode & Mid(strInputString, intRnd, 1)
Next
'Return the string
PasswordHash = strCode
End Function
Public Function ConvertBinary(ByVal strCode As String)
'Declarations
Dim arrBinary(8) As String
Dim strStep As String
Dim intCount As Integer
'Step through the randomly generated string of hex pairs by two and convert to binary
'while placing those binary values into an array
For p = 0 To (strCode.Length - 2) Step 2
strStep = strCode.Substring(p, 2)
Dim b As Integer = Convert.ToInt32(strStep, 16)
arrBinary(intCount) = b
intCount = intCount + 1
Next
'Return the populated array
ConvertBinary = arrBinary
End Function
Code: Select all
Procedure CreatePassword()
strInputString.s
strCode.s
intNameLength.i
intRnd.i
strInputString = "ABCDEF0123456789" ;Characters To choose from To generate random string
intNameLength = 16 ;Define length of random string
;Generate the random string
For intStep = 1 To intNameLength
intRnd = Random(8)
strCode = strCode + Mid(strInputString, intRnd, 1)
Next
;Return the string
PasswordHash.s = strCode
Debug PasswordHash
EndProcedure
Code: Select all
Procedure ConvertBinary(strCode.s)
Dim arrBinary.s(8)
strStep.s
intCount.i
;Step through the randomly generated string of hex pairs by two And convert To binary
;while placing those binary values into an Array
For p = 1 To (Len(strCode)) Step 2
strStep = Mid(strCode,p,2)
b.s = RSet(Bin(Val("$"+strStep)),8,"0")
arrBinary(intCount) = b
intCount = intCount + 1
Next
;Return the populated array
ConvertBinary = arrBinary
EndProcedure