Displaying Source Code(s)
|
|
Random Pronouncable Password
--------------------------------------------------------------------------------
Description : Create a random password that is pronouncable.
This helps users remember the password easier and can come up
with some silly words.
<%
Dim i
For i = 1 To 10
Response.Write RandomPassword(7, 10) & "<BR>"
Next
function RandomPassword(Min, Max)
Dim Password
Dim AddConsonant
Dim Letter
Dim Length
Dim Index
Dim Random
Const DoubleConsonants = "cdfglmnprst"
Const SingleConsonants = "bcdfghjklmnprstv"
Const Vowels = "aeiou"
Randomize()
Length = Int(Rnd * (Max - (Min - 1))) + Min
While Len(Password) < Length
Random = Int(Rnd * 100)
if Not Password = "" And AddConsonant And Random < 10 Then
Index = Int(Rnd * Len(DoubleConsonants)) + 1
Letter = Mid(DoubleConsonants, Index, 1)
Password = Password & Letter & Letter
AddConsonant = False
ElseIf Not Password = "" And AddConsonant And Random < 90 Then
Index = Int(Rnd * Len(SingleConsonants)) + 1
Letter = Mid(SingleConsonants, Index, 1)
Password = Password & Letter
AddConsonant = False
Else
Index = Int(Rnd * Len(Vowels)) + 1
Letter = Mid(Vowels, Index, 1)
Password = Password & Letter
AddConsonant = True
End if
Wend
if Len(Password) > Max Then Password = Left(Password, Max)
RandomPassword = Password
End function
%> |
|
|