Password Generator

  • Thread starter Thread starter avillela
  • Start date Start date
A

avillela

I'm looking for a password generator.

example: I pass as parameter a string and the function return a
password.(string)

can anyone provide me any password generator ????

thanks
André - Brazil
 
* "avillela said:
I'm looking for a password generator.

example: I pass as parameter a string and the function return a
password.(string)

can anyone provide me any password generator ????

Did you have a look for algorithms with Google?!
 
Are you wanting to generate a "Real" word? Or just a string of letters and numbers?

If the latter will work (like for a TEMPORARY pw generator), the function below will do it (getGenericPW). If you need the former, you could create an array of words and or phrases that you want to have available. The use the rnd function to randomly choose one of these words as shown in getSpecPW.

Other than these solutions, I have nothing to offer.

function getSpecPW() as string
dim count as integer = 1000 'total number of available words minus one (zero based)
dim pwArray(count)
return pwArray(Int((count - 0 + 1) * Rnd() + 0))
end function

Function getGenericPW() As String
Dim pw As String = ""
Dim cnt As Integer

'charCount is the number of characters in the desired pw
Dim charCount As Integer = 6
For cnt = 0 To charCount
'randomly choose between adding a number, UPPER or lower character
Select Case Int((3 - 1 + 1) * Rnd() + 1)
Case 1 'generate a number
pw = pw & Chr(Int((57 - 48 + 1) * Rnd() + 48))
Case 2 'generate an upper case letter
pw = pw & Chr(Int((90 - 65 + 1) * Rnd() + 65))
Case 3 'generate a lower case letter
pw = pw & Chr(Int((122 - 97 + 1) * Rnd() + 97))
End Select
Next
Return pw
End Function
 
Of course, if you really want the SPECIFIC version, an array with a decent number of strings will take a LOT of resources. It might be better to use an INI file.

I have downloaded a set of API wrappers that process ini files, if that's the route you want to go, I'll post them.

it would look something like this

declare the wrappers.
blah blah

function getPWfromINI () as string
dim count as integer = 1000 'total number of available words minus one (zero based)
return getINI("Passwords", "PW" & (Int((count - 0 + 1) * Rnd() + 0), "")
end function

and the INI file would look like

[Passwords]
PW0=kitchen
PW1=pencil
......so on.....

--

RDI

(remove the exclamation from the email address)

Are you wanting to generate a "Real" word? Or just a string of letters and numbers?

If the latter will work (like for a TEMPORARY pw generator), the function below will do it (getGenericPW). If you need the former, you could create an array of words and or phrases that you want to have available. The use the rnd function to randomly choose one of these words as shown in getSpecPW.

Other than these solutions, I have nothing to offer.

function getSpecPW() as string
dim count as integer = 1000 'total number of available words minus one (zero based)
dim pwArray(count)
return pwArray(Int((count - 0 + 1) * Rnd() + 0))
end function

Function getGenericPW() As String
Dim pw As String = ""
Dim cnt As Integer

'charCount is the number of characters in the desired pw
Dim charCount As Integer = 6
For cnt = 0 To charCount
'randomly choose between adding a number, UPPER or lower character
Select Case Int((3 - 1 + 1) * Rnd() + 1)
Case 1 'generate a number
pw = pw & Chr(Int((57 - 48 + 1) * Rnd() + 48))
Case 2 'generate an upper case letter
pw = pw & Chr(Int((90 - 65 + 1) * Rnd() + 65))
Case 3 'generate a lower case letter
pw = pw & Chr(Int((122 - 97 + 1) * Rnd() + 97))
End Select
Next
Return pw
End Function
 
you could use the hashfor storing method that comes with .net..??


Of course, if you really want the SPECIFIC version, an array with a decent number of strings will take a LOT of resources. It might be better to use an INI file.

I have downloaded a set of API wrappers that process ini files, if that's the route you want to go, I'll post them.

it would look something like this

declare the wrappers.
blah blah

function getPWfromINI () as string
dim count as integer = 1000 'total number of available words minus one (zero based)
return getINI("Passwords", "PW" & (Int((count - 0 + 1) * Rnd() + 0), "")
end function

and the INI file would look like

[Passwords]
PW0=kitchen
PW1=pencil
.....so on.....

--

RDI

(remove the exclamation from the email address)

Are you wanting to generate a "Real" word? Or just a string of letters and numbers?

If the latter will work (like for a TEMPORARY pw generator), the function below will do it (getGenericPW). If you need the former, you could create an array of words and or phrases that you want to have available. The use the rnd function to randomly choose one of these words as shown in getSpecPW.

Other than these solutions, I have nothing to offer.

function getSpecPW() as string
dim count as integer = 1000 'total number of available words minus one (zero based)
dim pwArray(count)
return pwArray(Int((count - 0 + 1) * Rnd() + 0))
end function

Function getGenericPW() As String
Dim pw As String = ""
Dim cnt As Integer

'charCount is the number of characters in the desired pw
Dim charCount As Integer = 6
For cnt = 0 To charCount
'randomly choose between adding a number, UPPER or lower character
Select Case Int((3 - 1 + 1) * Rnd() + 1)
Case 1 'generate a number
pw = pw & Chr(Int((57 - 48 + 1) * Rnd() + 48))
Case 2 'generate an upper case letter
pw = pw & Chr(Int((90 - 65 + 1) * Rnd() + 65))
Case 3 'generate a lower case letter
pw = pw & Chr(Int((122 - 97 + 1) * Rnd() + 97))
End Select
Next
Return pw
End Function
 
Back
Top