Forum Moderators: open
Function GeneratePassword()
Dim strPass, i
Randomize
For i = 0 To 7
Select Case Int(((3-1+1) * Rnd) + 1)
Case 1
strPass = strPass & Chr(Int(((57-48+1) * Rnd) + 48))
Case 2
strPass = strPass & Chr(Int(((122-97+1) * Rnd) + 97))
Case 3
strPass = strPass & Chr(Int(((122-97+1) * Rnd) + 97))
End Select
Next
GeneratePassword = strPass
End Function
this can be done with the rnd() function. to get a random password out of random numbers, create a loop depending on the passwords length and a string containing all allowed letters and numbers first. in each loop randomly pick out one of the letters with the rnd() function and concat them. voila, your random password is done.
[The MD5 algorithm] takes as input a message of arbitrary length and produces as output a 128-bit "fingerprint" or "message digest" of the input. It is conjectured that it is computationally infeasible to produce two messages having the same message digest, or to produce any message having a given prespecified target message digest. The MD5 algorithm is intended for digital signature applications, where a large file must be "compressed" in a secure manner before being encrypted with a private (secret) key under a public-key cryptosystem such as RSA.[faqs.org...]
The md5 digest of "Aaron" in a hex form is "1c0a11cc4ddc0dbd3fa4d77232a4e22e". If you take a unique message (time, process number, and some string) then your digest will be unique as well. This will solve your problem of getting the same password twice.
Andreas