hi
i am here to ask you question about asp. i am working on asp i am newly learning on this here i want to know how can i generate an ASP page a password of 8 characters strong.please tell me if someone knows thank you
hi
i am here to ask you question about asp. i am working on asp i am newly learning on this here i want to know how can i generate an ASP page a password of 8 characters strong.please tell me if someone knows thank you
Generate Random Password Function
<%
'Our Function generatePassword accepts one parameter 'passwordLength'
'passwordLength will obviously determine the password length.
'The aplhanumeric character set is assigned to the variable sDefaultChars
Function generatePassword(passwordLength)
'Declare variables
Dim sDefaultChars
Dim iCounter
Dim sMyPassword
Dim iPickedChar
Dim iDefaultCharactersLength
Dim iPasswordLength
'Initialize variables
sDefaultChars="abcdefghijklmnopqrstuvxyzABCDEFGHIJKLMNOPQRSTUVXYZ0123456789"
iPasswordLength=passwordLength
iDefaultCharactersLength = Len(sDefaultChars)
Randomize'initialize the random number generator
'Loop for the number of characters password is to have
For iCounter = 1 To iPasswordLength
'Next pick a number from 1 to length of character set
iPickedChar = Int((iDefaultCharactersLength * Rnd) + 1)
'Next pick a character from the character set using the random number iPickedChar
'and Mid function
sMyPassword = sMyPassword & Mid(sDefaultChars,iPickedChar,1)
Next
generatePassword = sMyPassword
End Function
Response.write generatePassword(6) 'Call the function & pass in 6 as the parameter
%>
read this How to create and use strong Password
How to generate an ASP page a password hard on 8 characters (a, A, 0)
Source Code
<%
gen_password function ()
word = ""
er = 0
for cpt = 1 to 8
do while st <> 1
randomize
int x = ((122 - 48 +1) * Rnd + 48) '--- product of the integers between 48 and 122
if x> 57 and x <65 then '--- test interval ds figure if unwanted
er = 0
else if x> 90 and x <97 then '--- test interval ds figure if unwanted
er = 0
else st = 1 '--- not figure unwanted interval ds
end if
end if
loop
y = chr (x) '--- convert a digit character
word = word & y '--- create character concatenation
er = 0
next
gen_password word = '--- returns the word password
end function
%>
Bookmarks