RosettaCodeData/Task/Password-generator/Run-BASIC/password-generator.basic

41 lines
931 B
Plaintext

a$(1) = "0123456789"
a$(2) = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
a$(3) = "abcdefghijklmnopqrstuvwxyz"
a$(4) = "!""#$%&'()*+,-./:;<=>?@[]^_{|}~"
a$(0) = a$(1) + a$(2) + a$(3) + a$(4)
[main]
print "----------- Password Generator -----------"
input "Number of Characters:";howBig
if howBig < 1 then goto [exit]
input "How many to generate:";howMany
if howMany < 1 then goto [main]
' -----------------------------
' Generate Password
' -----------------------------
[gen]
cls
print "Generate ";howMany;" passwords with ";howBig;" characters"
i = 0
while i < howMany
pw$ = ""
ok$ = "...."
pw$ = ""
for j = 1 to howBig
w$ = mid$(a$(0),int(rnd(0) * len(a$(0))) + 1,1)
for k = 1 to 4
if instr(a$(k),w$) then ok$ = left$(ok$,k-1) + "*" + mid$(ok$,k+1)
next k
pw$ = pw$ + w$
next j
if ok$ = "****" then ' Do we pass with the requirements
i = i + 1
print "#";i;" ";pw$
end if
WEND
goto [main]
[exit] ' get outta here
end