Skip to content

Commit

Permalink
Merge pull request #110 from akarshghildyal/password
Browse files Browse the repository at this point in the history
feat : password generator
  • Loading branch information
UTSAVS26 authored Oct 5, 2024
2 parents ec02615 + a6393ab commit 81790b4
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 0 deletions.
46 changes: 46 additions & 0 deletions Beginner_Projects/Password-Generator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
## **Password Generator**

### 🎯 **Goal**

The goal of this project is to create a secure and customizable password generator using Streamlit. The application allows users to generate passwords based on specified criteria, such as length and character types (uppercase, lowercase, digits, and special characters), and provides the ability to copy the generated password to the clipboard.

### 🧵 **Dataset**

No dataset is required for this project as it is focused on password generation.

### 🧾 **Description**

This project is a password generator built with Streamlit, offering a user-friendly interface to create passwords based on user-defined parameters. Users can adjust the password length, and choose whether to include uppercase letters, lowercase letters, digits, and special characters in the generated password. Once generated, the password is displayed and can be copied to the clipboard for easy use.

### 🧮 **What I had done!**

1. Built a simple Streamlit interface for users to generate passwords.
2. Created options for users to customize password length and character types (uppercase, lowercase, digits, special characters).
3. Displayed the generated password to the user.
4. Added functionality to copy the password to the clipboard with a single click.

### 🚀 **Models Implemented**

No machine learning models or algorithms were used in this project since the focus is on password generation logic using basic Python libraries.

### 📚 **Libraries Needed**

1. `Streamlit` - For building the user interface.
2. `random` - To randomly select characters for password generation.
3. `string` - To provide character sets (uppercase, lowercase, digits, punctuation).
4. `pyperclip` - To copy the generated password to the clipboard.

### 📊 **Exploratory Data Analysis Results**

N/A. This project doesn't involve datasets or EDA as it's focused on password generation.

### 📈 **Performance of the Models based on the Accuracy Scores**

N/A. This project does not involve models or algorithms that require accuracy evaluation.

### 📢 **Conclusion**

The password generator provides a simple and effective way for users to generate secure passwords based on their preferences. With adjustable length and customizable character types, this tool can help users create passwords that are both secure and easy to use.

**Akarsh Ghildyal**
[GitHub](https://github.com/AkarshGhildyal) | [LinkedIn](https://www.linkedin.com/in/akarsh-ghildyal/)
47 changes: 47 additions & 0 deletions Beginner_Projects/Password-Generator/passwordGenerator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import streamlit as st
import random
import string
import pyperclip

def passwordGenerator():
def generate_password(length, use_upper, use_lower, use_digits, use_special):
characters = ''
if use_upper:
characters += string.ascii_uppercase
if use_lower:
characters += string.ascii_lowercase
if use_digits:
characters += string.digits
if use_special:
characters += string.punctuation

if characters == '':
st.error("Please select at least one character type!")
return ""

password = ''.join(random.choice(characters) for _ in range(length))
return password

# app
st.title("Password Generator")

with st.form("password_generator_form"):
length = st.slider("Password length", min_value=4, max_value=30, value=8)
use_upper = st.checkbox("Include A-Z", value=True)
use_lower = st.checkbox("Include a-z", value=True)
use_digits = st.checkbox("Include 0-9", value=True)
use_special = st.checkbox("Include special characters", value=True)

submitted = st.form_submit_button("Generate Password")

if submitted:
password = generate_password(length, use_upper, use_lower, use_digits, use_special)
st.session_state.generated_password = password

if "generated_password" in st.session_state and st.session_state.generated_password:
st.write("Generated Password:")
st.code(st.session_state.generated_password, language="text")
if st.button("Copy to Clipboard"):
pyperclip.copy(st.session_state.generated_password)
st.success("Password copied to clipboard!")
passwordGenerator()
2 changes: 2 additions & 0 deletions Beginner_Projects/Password-Generator/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
streamlit==1.24.0
pyperclip==1.8.2

0 comments on commit 81790b4

Please sign in to comment.