You are on page 1of 18

A

MICRO PROJECT REPORT

ON

“RANDOM PASSWORD GENERATOR”

SUBMITTED BY –

Sr. No. Name of Student Roll No.


1 Parineeta Shital Hulle 51
2 Shreya Vitthal Vhanyalkar 59
3 Yash Sambhaji Lavhate 60

UNDER THE GUIDANCE OF


Mrs. S. A. Salunkhe

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING


SANJAY GHODAWAT POLYTECHNIC, ATIGRE
ACADEMIC YEAR: 2021-22

Certificate
This is to certify that the Micro project work entitled

“RANDOM PASSWORD GENERATOR”


Has been successfully completed by

In fulfilment for the

Diploma in Computer Science &Engineering

Maharashtra State Board of Technical Education

During the academic year 2021-22 under the guidance of

Mrs. S. A. Salunkhe Mr. S. V. Chavan


Project Guide H.O.D

Mr. V. V. Giri
Principal
DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING

Program Code – CW-4-I

Course Name – JAVA Programming

Course Code – 22412

Project Title

“RANDOM PASSWORD GENERATOR”

Micro Project Total


Sr. Roll Enrollment Exam Seat Marks Marks
Name of Student
No. No. No. No.
G I 6+4=10

1 Parineeta S. Hulle 51 2016440101

2 Shreya V. Vhanyalkar 59 2016440110

3 Yash S. Lavhate 60 2016440111

Mrs. S. A. Salunkhe
Course Faculty & Signature
Program Name – Computer Science & Engineering Program Code – CW-4-I

Course Name – JAVA Programming Course Code – 22412

Project Title – “Random Password Generator”

Course Outcomes (CO), Practical Outcomes (PRO’s) and Unit Outcomes (UOs) Mapping
COs PRO’s and PSO UOs
Mapping

CW403.1 – PRO’s Sr. No. 1a. We have learned to write a java program of
Develop program 1,2,3,4,5,6,7,8,9,10, Random Password generator.
using object-oriented 11,12.
methodology in java.

PSO Mapping
PSO2: Setup a java
programming
development
environment.
MICRO PROJECT DIARY
Week
From Date to Date ACTIVITY PERFORMED
No.

I 21st Feb to 26th Feb 22 Decide Project title

II 28th Feb to 5th March 22 Introduction

III 7th March to 12th March 22 Gather information and analysis

IV 21st March to 26th March 22 Set of important statements

V 28th March to 2nd April 22 Write algorithm

VI 4th April to 9th April 22 Program code

VII 11th April to 16th April 22 Output/ result

VIII 18th April to 23rd April 22 Advantages and Disadvantages

IX 25th April to 30th April 22 Conclusion

X 2nd May to 7th May 22 Reference


INDEX
Sr. No. Content Page No

Abstract

1 Introduction 1

2 Statements 2

3 Program 4

4 Output/Result 8

5 Advantages and Disadvantages 9

6 Conclusion 10

7 Reference 11
ABSTRACT
A random password generator is software program or hardware device that takes input
from a random or pseudo-random number generator and automatically generates a password.
Random passwords can be generated manually, using simple sources of randomness such
as dice or coins, or they can be generated using a computer.

While there are many examples of "random" password generator programs available on the
Internet, generating randomness can be tricky and many programs do not generate random
characters in a way that ensures strong security. A common recommendation is to use open
source security tools where possible since they allow independent checks on the quality of the
methods used. Note that simply generating a password at random does not ensure the password is
a strong password, because it is possible, although highly unlikely, to generate an easily guessed
or cracked password. In fact, there is no need at all for a password to have been produced by a
perfectly random process: it just needs to be sufficiently difficult to guess.

A password generator can be part of a password manager. When a password policy enforces
complex rules, it can be easier to use a password generator based on that set of rules than to
manually create passwords.

Long strings of random characters are difficult for most people to memorize. Mnemonic hashes,
which reversibly convert random strings into more memorable passwords, can substantially
improve the ease of memorization. As the hash can be processed by a computer to recover the
original 60-bit string, it has at least as much information content as the original string.[1] Similar
techniques are used in memory sport.
Random Password Generator

1. Introduction

Passwords are a real security threat. Over 80% of hacking-related breaches are due to weak or
stolen passwords, a recent report shows . So, if you want to safeguard your personal info and
assets, creating secure passwords is a big first step. And that’s where the LastPass Password
Generator can help. Impossible-to-crack passwords are complex with multiple types of
characters (numbers, letters, and symbols). Making your passwords different for each website
or app also helps defend against hacking. This password generator tool runs locally on your
Windows, Mac or Linux computer, as well as your iOS or Android device. The passwords you
generate are never sent across the web.

A password is typically a string of characters that may include letters, numbers, and symbols
that can be used to access something, typically an account, and prevent others from accessing
it. In today's Internet age, it is likely that most people have experience with having a password
for some kind of account. As such, it is important to understand how to construct a strong
password (or use a password generator) as well as to understand how to take measures to
safeguard the password.

Password strength is a measure of how effective a password is against being guessed or against
brute-force attacks. Although it varies, usually, password strength is an estimate of how many
trials would be required on average for someone to successfully guess the password. This is
affected by the length, complexity, and unpredictability of the password. For example, if a
password involves a person's name, birthday, or other personal information that typically would
not be very difficult to find out, the password would likely make for a weak password.

Aside from the actual password, proper security controls play a significant role in reducing the
risk of a security breach. Security controls include safeguards that are in place to detect, avoid,
or minimize security risks. This includes controls such as two-step authentication for your
password, or locking the account for a period of time after a given number of failed attempts.

SANJAY GHODAWAT POLYTECHNIC, ATIGRE 1


Random Password Generator

2. STATEMENTS
• FOR LOOP:

The for Loop. The for loop in Java is an entry-controlled loop that allows a user to execute a
block of a statement(s) repeatedly with a fixed number of times on the basis of the test
expression or test-condition. This is the easiest to understand Java loops.

• ARRAY:

Java array is an object which contains elements of a similar data type. Additionally, the
elements of an array are stored in a contiguous memory location. It is a data structure where
we store similar elements. We can store only a fixed set of elements in a Java array.

• If-else-if Ladder:

Java if-else-if ladder is used to decide among multiple options. The if statements are executed
from the top down. As soon as one of the conditions controlling the if is true, the statement
associated with that if is executed, and the rest of the ladder is bypassed. If none of the
conditions is true, then the final else statement will be executed.

o Syntax:

if (condition)

statement 1;

else if (condition)

statement 2;

else

statement;

SANJAY GHODAWAT POLYTECHNIC, ATIGRE 2


Random Password Generator

• RETURN:

In Java, return is a reserved keyword i.e., we can’t use it as an identifier. It is used to exit from
a method, with or without a value. Usage of return keyword as there exist two ways as listed
below as follows:
• Case 1: Methods returning a value
• Case 2: Methods not returning a value

• JAVA SCANNER CLASS:

Scanner is a class in java. util package used for obtaining the input of the primitive types like
int, double, etc. and strings. It is the easiest way to read input in a Java program, though not
very efficient if you want an input method for scenarios where time is a constraint like in
competitive programming.

SANJAY GHODAWAT POLYTECHNIC, ATIGRE 3


Random Password Generator

3. PROGRAM:

import java.util.Scanner;

class password {
public static void main (String [] args) {

//Create a Scanner (import it above!) and ask the user how many random passwords they
want generated
Scanner in = new Scanner (System.in);
System.out.print("How many random passwords do you want to generate? ");
int total = in.nextInt();

//Ask the user how long they want their random passwords to be
System.out.print("How long do you want your random passwords to be? ");
int length = in.nextInt();

//Create an array of random passwords (Strings)


String[] randomPasswords = new String[total];

//Randomly generate passwords total number of times


for(int i = 0; i < total; i++) {
//Create a variable to store the random password
String randomPassword = "";
//Randomly generate a character for the password length number of times
for(int j = 0; j < length; j++) {
//Add a random lowercase or UPPERCASE character to our randomPassword String
randomPassword += randomCharacter();
}
//Add the random password to your array
randomPasswords[i] = randomPassword;
}

SANJAY GHODAWAT POLYTECHNIC, ATIGRE 4


Random Password Generator

//Print out the random passwords array


printArray(randomPasswords);

//EXTENSION!!
//Print out the password strength by calling our getPasswordStrength function
//Use string concatenation to make it look pretty :)
System.out.println("Your password strength: " + getPasswordStrength(length));

//Create a function that prints out an array that is passed in as a parameter


public static void printArray(String[] arr) {
for(int i = 0; i < arr.length; i++) {
System.out.println(arr[i]);
}
}

//Create a function that randomly generates a letter (lowercase or uppercase) or number (0-
9) using ASCII
//'0' - '9' => 48-57 in ASCII
//'A' - 'Z' => 65-90 in ASCII
//'a' - 'z' => 97-122 in ASCII
public static char randomCharacter() {
//We multiply Math.random() by 62 because there are 26 lowercase letters, 26 uppercase
letters, and 10 numbers, and 26 + 26 + 10 = 62
//This random number has values between 0 (inclusive) and 62 (exclusive)
int rand = (int) (Math.random() *62);

//0-61 inclusive = all possible values of rand


//0-9 inclusive = 10 possible numbers/digits
//10-35 inclusive = 26 possible uppercase letters
//36-61 inclusive = 26 possible lowercase letters

SANJAY GHODAWAT POLYTECHNIC, ATIGRE 5


Random Password Generator

//If rand is between 0 (inclusive) and 9 (inclusive), we can say it's a number/digit
//If rand is between 10 (inclusive) and 35 (inclusive), we can say it's an uppercase letter
//If rand is between 36 (inclusive) and 61 (inclusive), we can say it's a lowercase letter

if (rand <= 9) {
//Number (48-57 in ASCII)
//To convert from 0-9 to 48-57, we can add 48 to rand because 48-0 = 48
int number = rand + 48;
//This way, rand = 0 => number = 48 => '0'
//Remember to cast our int value to a char!
return (char)(number);
}
else if (rand <= 35) {
//Uppercase letter (65-90 in ASCII)
//To convert from 10-35 to 65-90, we can add 55 to rand because 65-10 = 55
int uppercase = rand + 55;
//This way, rand = 10 => uppercase = 65 => 'A'
//Remember to cast our int value to a char!
return (char)(uppercase);
}
else {
//Lowercase letter (97-122 in ASCII)
//To convert from 36-61 to 97-122, we can add 61 to rand because 97-36 = 61
int lowercase = rand + 61;
//This way, rand = 36 => lowercase = 97 => 'a'
//Remember to cast our int value to a char!
return (char)(lowercase);
}
}

//EXTENSION!!
//Create a function that returns the password strength ("weak", "medium", "strong") based
on the password length

SANJAY GHODAWAT POLYTECHNIC, ATIGRE 6


Random Password Generator

public static String getPasswordStrength(int length) {


if (length < 5) {
return "weak";
}
else if (length < 10) {
return "medium";
}
else {
return "strong";
}
}
}

SANJAY GHODAWAT POLYTECHNIC, ATIGRE 7


Random Password Generator

4. OUTPUT:

SANJAY GHODAWAT POLYTECHNIC, ATIGRE 8


Random Password Generator

5. ADVANTAGES AND DISADVANTAGES:

• ADVANTAGES:
1. No need to remember all passwords.
2. It allows generating robust passwords.
• DISADVANTAGES:
1. Forgetting master password could be disastrous.
2. Forgetting to sing out could allow someone access to all accounts.
3. It may not protect your data from specific threats.

SANJAY GHODAWAT POLYTECHNIC, ATIGRE 9


Random Password Generator

6. CONCLUSION
This technique gives several benefits to users such as security, and confidentiality. The
password generated using proposed technique is more secure because it is chosen from
a large distribution of passwords and is stronger than user created passwords.

SANJAY GHODAWAT POLYTECHNIC, ATIGRE 10


Random Password Generator

REFERENCE

1. https://pdf.sciencedirectassets.com/282073/1-s2.0-S2212017312X00057/1-
s2.0-S2212017312002976/main.pdf?X-Amz-Security
Token=IQoJb3JpZ2luX2VjEF
2. https://www.researchgate.net/publication/305388934_Password_Generators_
Old_Ideas_and_New
3. Notepad++
4. Command Prompt
5. https://junilearning.com/blog/coding-projects/make-a-java-random-password-
generator/

SANJAY GHODAWAT POLYTECHNIC, ATIGRE 11

You might also like