aditya_exceed[1]
aditya_exceed[1]
Faculty Signature:
Index :
Introduction
Features of the App
Technologies Used
Step-by-Step Implementation
conclusion
Introduction:
A password locker app helps users manage their passwords by securely
storing them in an encrypted format. The app will have functionalities such
as adding, viewing, editing, and deleting password entries.
List all accounts: Users can view all the accounts for which passwords are
stored.
Technologies Used
Java Programming Language
Step-by-Step Implementation
1. Setting Up the Project
Create a new Java project in your preferred IDE (e.g., IntelliJ IDEA, Eclipse).
Create a class named PasswordLockerApp.
java
Copy
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
switch (choice) {
case 1:
addPassword();
break;
case 2:
retrievePassword();
break;
case 3:
deletePassword();
break;
case 4:
listAllAccounts();
break;
case 5:
System.out.println("Exiting...");
return;
default:
System.out.println("Invalid choice. Please try again.");
}
}
}
}
3. Adding a Password
To add a password, we will encrypt it using a simple Caesar Cipher before
storing it in the HashMap.
java
Copy
private static void addPassword() {
System.out.print("Enter account name: ");
String account = scanner.nextLine();
System.out.print("Enter password: ");
String password = scanner.nextLine();
java
Copy
if (passwordMap.containsKey(account)) {
} else {
}
private static String decrypt(String encryptedPassword) {
if (Character.isLetter(c)) {
} else {
decrypted.append(c);
return decrypted.toString();
5. Deleting a Password
To delete a password, the user will provide the account name, and the app will remove the entry
from the HashMap.
java
Copy
if (passwordMap.containsKey(account)) {
passwordMap.remove(account);
} else {
The app will display all the account names for which passwords are stored.
java
Copy
if (passwordMap.isEmpty()) {
} else {
System.out.println("Stored Accounts:");
Compile and run the PasswordLockerApp class. The app will display a menu for the user to interact
with.
HashMap for Storage: The HashMap is used to store account names and encrypted passwords. It
provides fast lookups and easy management of key-value pairs.
Encryption and Decryption: The Caesar Cipher is used for basic encryption. Each character in the
password is shifted by a fixed number (the encryption key). For example, 'a' becomes 'd' with a key
of 3.
User Interaction: The app uses a Scanner to take input from the user and a switch statement to
handle different options.
Security Note: The Caesar Cipher is used here for simplicity. In a real-world application, you should
use stronger encryption algorithms like AES.
Full Code
java
Copy
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
while (true) {
System.out.println("5. Exit");
switch (choice) {
case 1:
addPassword();
break;
case 2:
retrievePassword();
break;
case 3:
deletePassword();
break;
case 4:
listAllAccounts();
break;
case 5:
System.out.println("Exiting...");
return;
default:
passwordMap.put(account, encryptedPassword);
if (passwordMap.containsKey(account)) {
} else {
if (passwordMap.containsKey(account)) {
passwordMap.remove(account);
} else {
if (passwordMap.isEmpty()) {
} else {
System.out.println("Stored Accounts:");
if (Character.isLetter(c)) {
} else {
encrypted.append(c);
return encrypted.toString();
if (Character.isLetter(c)) {
} else {
decrypted.append(c);
return decrypted.toString();
Conclusion
This password locker app is a simple yet effective way to manage passwords securely. It
demonstrates the use of Java collections, basic encryption, and user interaction. You can enhance
this app by adding features like saving data to a file, using stronger encryption, or adding a
graphical user interface (GUI).