PASSWORD GENERATOR
Submitted
in the fulfillment of the
assignment for the award
of
INTERNAL MARKS IN
SEM
in
METALLURGY AND MATERIALS ENGINEERING
by
D.P.V SRI VAISHNAVI 24261A1807
D.SAI SRINIKETH 24261A1808
Under the guidance of
Ms. M. NAVYA
(Assistant Professor)
DEPARTMENT OF COMPUTER SCIENCE AND
ENGINEERING MAHATMA GANDHI INSTITUTE
OF TECHNOLOGY(A) HYDEREABAD-500075,
TELANGANA
1
CERTIFICATE
This is to certify that the report entitled “PASSWORD GENERATOR” being submitted by
D.P.V SRI VAISHNAVI,
D.SAI SRINIKETH bearing Reg.No.24261A1807,24261A1808 in partial fulfillment for the
award of internal marks for semester (B. Tech) in METALLURGY AND MATERIALS
ENGINEERING to the Department of CSE, MAHATMA GANDHI INSTITUTE OF
TECHNOLOGY(A), Hyderabad 500075, T.S. is a record of Bonafide work carried out by
her under our guidance and supervision, at our organization/institution.
The results embodied in this report have not been submitted to any
other university or institute for the award of any degree or diploma.
Signature of Supervisor Signature of HOD
Ms. M. Navya Dr.K.Ramanjeyalu
Assistant Professor HOD
2
DECLARATION
I hereby declare that the work described in this report, entitled “PASSWORD
GENERATOR” which is being submitted by me in partial fulfillment for the award of
internal marks for semester (B. Tech) in Metallurgy and Materials Engineering to the
Department of CSE, Mahatma Gandhi Institute of Technology(A), Hyderabad-
500075, T.S. is the result of investigations carried out by me under the guidance of Ms.
M. Navya.
Further I declare that this is my original work and the analysis and the
findings are for academic purpose only.
Place: Hyderabad
Date: 10/07/2025
Signature:
Name of the Students: D.P.V SRI VAISHNAVI
D.SAI SRINIKETH
Reg nos: 24261A1807
24261A1808
3
ABSTRACT
In today's digital era, the security of online accounts and sensitive data relies heavily on the strength of
passwords. This project presents a simple yet effective password generator built using Python.
The program allows users to generate strong, random passwords of customizable lengths using a
combination of uppercase letters, lowercase letters, digits, and special characters. It utilizes Python's built-
in random and string modules to efficiently assemble secure passwords, reducing the risk of password
guessing or brute-force attacks.
The project is user-friendly and demonstrates core programming concepts such as functions, loops, string
manipulation, and user input handling. It serves as a practical tool for promoting good cybersecurity habits
and illustrates how basic programming can be applied to real-world problems
4
TABLE OF CONTENTS
TITLE PAGE NO
INTRODUCTION 6
IMPLEMENTATION 7-8
ALGORITHM 9-10
CODE 11
RESULTS 12
CONCLUSION 13
REFERENCES 14
5
INTRODUCTION
In the digital world, passwords play a critical role in protecting personal data, online accounts, and confidential
information. With increasing threats like hacking and identity theft, it is important to use strong and
unpredictable passwords. However, manually creating such passwords can be difficult and time-consuming.
This project aims to solve that problem by developing a simple password generator using Python. The program
allows users to generate secure passwords of any desired length using a random combination of letters,
numbers, and special characters. By using Python’s built-in libraries such as random and string, the program
ensures that each generated password is unique, strong, and difficult to guess.
The project also helps students understand basic programming concepts such as functions, loops, user input,
and string operations while applying them to a practical and useful application.
6
IMPLEMENTATION
The password generator program is implemented using the Python programming language, making use of
its built-in libraries to handle character sets and random selection. The following steps describe the
implementation process in detail:
Step 1: Import Required Modules
import random
import string
random: Used to randomly select characters.
string: Provides predefined sets of characters like letters, digits, and punctuation.
Step 2: Define the Password Generation Function
def generate_password(length):
characters = string.ascii_letters + string.digits + string.punctuation
password = ''.join(random.choice(characters) for _ in range(length))
return password
string.ascii_letters: Includes both lowercase and uppercase letters.
string.digits: Adds numeric characters (0–9).
string.punctuation: Adds special characters (!, @, #, etc.).
random.choice(): Picks a random character from the combined character set.
The join() function creates a complete password string.
Step 3: Get User Input and Display Result
length = int(input("Enter the password length: "))
7
print("Generated Password:", generate_password(length))
The user is prompted to enter the desired password length.
The program calls the function and displays the generated password.
Sample Output:
Enter the password length: 10
Generated Password: A9#fP3!kLm
This implementation is both simple and effective, and it ensures the creation of strong passwords that can
enhance security for personal and professional accounts.
8
ALGORITHM
Step 1:
Start the program.
Step 2:
Import the required Python modules:
random for random selection
string for character sets (letters, digits, symbols)
Step 3:
Prompt the user to enter the desired password length.
Step 4:
Combine the following character sets into one string:
Uppercase and lowercase letters (string.ascii_letters)
Digits (string.digits)
Special symbols (string.punctuation)
Step 5:
Initialize an empty string to store the final password.
Step 6:
9
Repeat the following steps n times (where n is the password length):
Randomly select one character from the combined set.
Append the selected character to the password string.
Step 7:
Display the generated password to the user.
Step 8:
End the program.
10
CODE:-
import random
import string
# Simple password generator
def generate_password(length):
characters = string.ascii_letters + string.digits +
string.punctuation
password = ''.join(random.choice(characters) for
_ in range(length))
return password
# Example usage
length = int(input("Enter the password length: "))
print("Generated Password:",
generate_password(length))
11
RESULTS
12
CONCLUSION
The Password Generator project successfully demonstrates how Python can be used to create a simple yet
powerful tool for generating secure and random passwords. By using built-in modules like random and
string, the program ensures that each password is unique and difficult to predict, enhancing the overall
security of user accounts and personal data.
This project not only helps in understanding essential programming concepts such as user input, loops,
string manipulation, and functions, but also highlights the importance of strong passwords in today’s digital
world. The implementation is lightweight, user-friendly, and can be further extended to include features like
password strength indicators or user-defined character sets.
Overall, this project is a practical example of how coding skills can be applied to solve real-world security
problems.
13
REFERENCES
1. https://www.geeksforgeeks.org
2. https://github.com/
14