How to resolve the algorithm Password generator step by step in the Run BASIC programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Password generator step by step in the Run BASIC programming language

Table of Contents

Problem Statement

Create a password generation program which will generate passwords containing random ASCII characters from the following groups:

The generated password(s) must include   at least one   (of each of the four groups):

The user must be able to specify the password length and the number of passwords to generate. The passwords should be displayed or written to a file, one per line. The randomness should be from a system source or library. The program should implement a help option or button which should describe the program and options when invoked. You may also allow the user to specify a seed value, and give the option of excluding visually similar characters. For example:           Il1     O0     5S     2Z           where the characters are:

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Password generator step by step in the Run BASIC programming language

Source code in the run programming language

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

  

You may also check:How to resolve the algorithm Zebra puzzle step by step in the FormulaOne programming language
You may also check:How to resolve the algorithm Terminal control/Cursor positioning step by step in the Perl programming language
You may also check:How to resolve the algorithm Parallel brute force step by step in the C# programming language
You may also check:How to resolve the algorithm Bitmap/Bézier curves/Cubic step by step in the Action! programming language
You may also check:How to resolve the algorithm Sparkline in unicode step by step in the Java programming language