A
PROJECT
REPORT
ON
RANDOM
PASSWROD
GENERATOR
INTRODUCTION
We know that passwords are a real security threat.
Tokeep your account safe and prevent your
passwordfrom being hacked you have to make your
passwordhard enough that nobody can guess.
Password Generator
It is a tool that generates passwords based on the
given guidelines that you set to create an
unpredictable strong password for your accounts.
The Password Generator tool creates a random and
customized password for users that helps them to
create a strong password which provides greater
security.
Password Generator Python Project
The objective of this project is to create a password
generator using python. The password generator
project will be build using python modules like
Tkinter, random, string, pyperclip. In this project,
the user has to select the password
length and then click on the “Generate Password”
button. It will show the generated password below.
the user clicks on the “Copy to Clipboard” button,
then it will copy the password automatically.
Project Prerequisites
To build this project we will use the basic concept
of python and libraries – Tkinter, pyperclip, random,s
tring.
Tkinter is a standard GUI library and is one of the
easiest ways to build a GUI application.
pyperclip module allows us to copy and paste
text to and from the clipboard to your computer
The random module can generate random
numbers
String module contains a number of functions to
process the standard python string.
For coding purpose Microsoft Visual Studio idea was
used and code was written using python language.
Project File Structure
Let’s check the step to build a Password Generator
using Python
Import modules
Initialized Window
Select Password Length
Define Function
Methodology
Building up a project on Random Password Generator
was a great piece of experience, it not only help me
In gathering information about new
technologies but also made me realize the use of prog
ramming in real life. Discussing about how this
learning process started and journey up to building up
this project goes like this:
First of all we need to import libraries like
tkinter,random, string, pyperclip considering you have
already installed python and its related features like
pip. Each of these libraries has its own feature from
which some are used in building this project .Then we
need to Initialize Window which work as a interface
for our application. We initialize window by using
function like
Tk ()
initialized tkinter which means window created
Geometry () set the width and height of thewindow
Resizable(0,0)
set the fixed size of the window
Title()
set the title of the window
Label()
widget use to display on or more than one lineof text
that users can’t able to modify.
root is the name which we refer to our window text
which we display on the label
font in which the text is written
pack organized widget in block
pass_len is an integer type variable that stores the
length of a password.
To select the password length we use Spinbox()
widget.
Spinbox() widget is used to select from a fixed
number of values. Here the value from 8 to 32.
Function to Generate Password
pass_str is a string type variable that stores the
generated password
password= “” is the empty string
First loop will generate a string of length 4which is
a combination of an uppercase letter, a
lowercase letter, digits, and a special symbol and that
string will store in password variable.
The second loop will generate a random string of
length entered by the user – 4 and add to the
password variable. Here we minus 4 to the length of
the user because we already generate the string of
length 4.
We have done this because we want a password
which must contain an uppercase, a lowercase, a digit,
and a special symbol. Now the password is set to the
pass_str () variable.
Button() widget used to display button on our
window
command is called when the button is click
Entry() widget used to create an input text field
Text variable used to retrieve the current text to
the entry widget
Function to Copy Password pyperclip.copy()
used to copy the text to clipboard Python Password
Generator Output
Conclusion
The completion of the project went quiet well, I
learned much new things while I was building up it,
and I get up to know various platforms which helps us
to learn all this stuff. I was able to learn the
practicaluars of python in making applications. The pr
actical helped me to learn debugging of code, about
populartkinter library to redering graphics in our disp
lay window and I also learned about pyperclip and
randomlibrary.I learned howto create buttons, input
text field, labels ,and spin box. In this way,I
successfully created random password generator
python project. Overall working on this project was
great fun as I came up with great piece of knowledge
and understanding of the topic.
Reference:
● You tube (Code With Harry)
● GitHub
Source Code
import string
import random
# store all characters in lists
s1 = list(string.ascii_lowercase)
s2 = list(string.ascii_uppercase)
s3 = list(string.digits)
s4 = list(string.punctuation)
# Ask user about the number of characters
user_input = input("How many characters do you want in your password?
")
# check this input is it number? is it more than 8?
while True:
try:
characters_number = int(user_input)
if characters_number < 8:
print("Your number should be at least 8.")
user_input = input("Please, Enter your number again: ")
else:
break
except:
print("Please, Enter numbers only.")
user_input = input("How many characters do you want in your
password? ")
# shuffle all lists
random.shuffle(s1)
random.shuffle(s2)
random.shuffle(s3)
random.shuffle(s4)
# calculate 30% & 20% of number of characters
part1 = round(characters_number * (30/100))
part2 = round(characters_number * (20/100))
# generation of the password (60% letters and 40% digits &
punctuations)
result = []
for x in range(part1):
result.append(s1[x])
result.append(s2[x])
for x in range(part2):
result.append(s3[x])
result.append(s4[x])
# shuffle result
random.shuffle(result)
# join result
password = "".join(result)
print("Strong Password: ", password)
Thank You