Sie sind auf Seite 1von 26

OBJECTIVE

The objective of this project is to generate the password randomly on providing the employee details and store it in a separate text file. The password generated can be numeric, alphabetic and alphanumeric and all the passwords generated must be unique i.e. no two employees can have the same password.

The Number of unique passwords generated through this project are quite large, so each employee can be alloted a unique password. The password generated can be used by the employee to have access to their account and to the company's information to which they are authorized to. Every effort has been made to generate a password that cannot be cracked easily but there is no guarantee to protect passwords from brute-force cracking. However the password generated here would take a considerable amount of time to crack.

FEASIBILITY STUDY

A feasibility study is a preliminary study, which investigates the information needs of the user and determines the proposed project. In our study of the requirement, we found that the project is feasible and could be completed within the time, cost and requirement (both software and hardware) constraints applied to it. The main objective of the project is to apply a new method and new tools for maximum efficiency which makes it feasible. Problems are identified and reviewing related information solutions. Identifying measures or indicators of system performance and the actions needed to improve or correct performance, relative to the goal of the system. Obtaining and seeing to the appropriate use of equipment, facilities, and materials needed to do certain work. Determining the kind of tools and equipment needed to make project work. Installing equipments, machines, wiring or programs to meet specifications. Performing routine maintenance on equipment and determining when and what kind of maintenance is needed. Observing, receiving and otherwise obtaining information from all relevant sources about their all work activities. Communicating with people outside the organization, representing the organizations to customers, public, government, and other external sources, to meet out their expectations. Developing specific goals and plans to prioritize, organise and accomplish your work. The main objective of the project Random Password Generator is to reduce the time and efforts on the part of the company to provide a unique password to each and every employee to have access to only part of the information in the company that they are required to know. Thus it helps in providing security in an organisation.

SRS DOCUMENT Random Password Generator

Input fields required by the user: (i) (ii) (iii) (iv) Length of the password. Type of password. Employee name. Employee id.

Operations: (i) (ii) A random password is generated which is either a combination of numbers, lower and uppercase letters, or of numbers and letters. The random password generated is saved in a text file password.txt.

SYSTEM DESIGN
The project Random Password Generator can be divided into five modules. They are as follows: main module. Numeric random password generator module. Alphabetic random password generator module. Alphanumeric random password generator module. Compare module.

These modules are designed in C and the various features provided by it such as file handling, standard library functions etc. The reason behind using C is because of its simplicity, easy to implement approach and availability of a wide range of features. The various features of C used in the development of current project are: File handling. Standard C functions.

DATABASE DESIGN

The DATABASE is designed using the FILES and is an essential part of the project. All the random passwords generated are stored along with the employees information in the database designed using FILES.

This file can be used by the company to provide access to the employees account by matching the particulars entered by the employees. The operations can be: - Getting the input from the user. - Matching it with the database. - Providing access to the account only if the particulars are correct.

MODULES

The various modules of the project Random Password Generator as classified and implemented are:

main function
This module is used to take the input from the user such as employee name, employee id, length of the password and type of the password. Based on the inputs provided by the user, this module transfer the control to respective module.

Numeric_Password_Generator function.
This module generates a random numeric password of the length given by the user and then compares it with the password database file. If the generated passsword is already present in the database, then the code exits and needs to be called again for the same employee details. Otherwise the generated password is stored along with employee details in the database file.

Alphabetic_Password_Generator function.
This module generates a random alphabetic password of the length given by the user which is a combination of both lower and uppercase letters and then compares it with the password database file. If the generated passsword is already present in the database, then the code exits and needs to be called again for the same employee details. Otherwise the generated password is stored along with employee details in the database file.

Alphanumeric_Password_Generator function.
This module generates a random alphanumeric password of the length given by the user which is a combination of both lower and uppercase letters and numbers and then compares it with the password database file. If the generated passsword is already present in the database, then the code exits and needs to be called again for the same employee details. Otherwise the generated password is stored along with employee details in the database file.

Compare function.
This module compares the password generated with the password field in the database file. If the password is already present then this function returns false otherwise the control is transferred to the respective module.

FLOWCHARTS MODULE 1 : main function


START

ENTER THE EMP NAME AND EMP ID

ENTER THE LENGTH

IF LENGTH >=8 AND LENGTH <=12

ENTER THE TYPE OF PASSWORD

IF TYPE = NUMERIC

NO

YES YES

IF TYPE = ALPHABETIC NO

MODULE 1:NUMERIC_ MODULE 1:ALPHABETIC_ PASSWORD_GENERATOR PASSWORD_GENERATOR

MODULE 1:ALPHANUMERIC _PASSWORD_GENERATOR

STORE THE PASSWORD IN TEXT FILE. PASSWORD.TXT 8 END

MODULE 2 : Numeric_Password_Generator function.


START

OPEN FILE STREAM

READ CHARACTER FROM FILE

NO

IF CHARACTER IS EOF

YES GENERATE NUMERIC PASSWORD

IF COMPARE (PASSWORD) IS 0

YES

NO PUT EMPLOYEES NAME, ID AND PASSWORD

END

MODULE 3 : Alphabetic_Password_Generator function.


START

OPEN FILE STREAM

READ CHARACTER FROM FILE

NO

IF CHARACTER IS EOF

YES GENERATE ALPHABETIC PASSWORD

IF COMPARE (PASSWORD) IS 0

YES

NO PUT EMPLOYEES NAME, ID AND PASSWORD

END

10

MODULE 4 : Alphanumeric_Password_Generator function.


START

OPEN FILE STREAM

READ CHARACTER FROM FILE

NO

IF CHARACTER IS EOF

YES GENERATE ALPHANUMERIC PASSWORD

IF COMPARE (PASSWORD) IS 0

YES

NO PUT EMPLOYEES NAME, ID AND PASSWORD

END

11

MODULE 5 : Compare function


START

SET FLAG=1 OPEN FILE STREAM

READ CHARACTER FROM FILE

IF CHARACTER IS EOF

NO

READ THE PASSWORD FIELD FROM FILE.

YES

YES IF PASSWORD PRESENT.SET FLAG=2

YES IF FLAG IS 2 NO

NO

YES YES RETURN 1 RETURN 0

END

12

CODING

#include<stdio.h> #include<conio.h> #include<stdlib.h> #include<process.h> #include<time.h> #include<string.h> void Numeric_Password_Generator(int x); void Alphabetic_Password_Generator(int x); void Alphanumeric_Password_Generator(int x); int Compare(char *); char empname[20],empid[10]; char password[15]={NULL}; void main() { int length,type; clrscr(); printf("\nEnter the emp name:\n"); scanf("%s",empname); printf("Enter the empid:\n"); scanf("%s",empid); printf("Enter the length between 8 and 12:\n"); scanf("%d",&length); printf("Type of password \n 1 : Numeric\n 2 : Alphabetic\n 3 : Alphanumeric \n");
13

scanf("%d",&type); if(type==1) Numeric_Password_Generator( (length); if(type==2) Alphabetic_Password_Generator( (length); if(type==3) Alphanumeric_Password_Generator( (length); getch(); }

/* Numeric_Password_Generator Function. This function generates the passwords of numeric types on providing the password length. */ void Numeric_Password_Generator (int l) { int i,pq; time_t t; FILE *fp; char ch; fp=fopen("Password.txt","a+"); while(1) { ch=fgetc(fp); if(ch==EOF) break;
14

} srand((unsigned)time(&t)); for(i=0;i<l;i++) { pq=rand()%10; printf("%d",pq); itoa(pq,(password+i),10); } if(Compare(password)==0) { fputs(empname,fp); fputs("\t",fp); fputs(empid,fp); fputs("\t",fp); fputs(password,fp); fputs("\n",fp); } fclose(fp); }

/*Alphabetic_Password_Generator Function. The function generates the passwords consisting of random uppercase and lowercase letters on providing the password length */ void Alphabetic_Password_Generator (int l)

15

{ int i,lp; time_t t; FILE *fp; char ch; fp=fopen("Password.txt","a+"); while(1) { ch=fgetc(fp); if(ch==EOF) break; } srand((unsigned)time(&t)); for(i=0;i<l;i++) { lp=random(58)+65; if(lp>=91&&lp<=96) { i--; continue; } printf("%c",lp); password[i]=(char)lp;

}
16

if(Compare(password)==0) { fputs(empname,fp); fputs("\t",fp); fputs(empid,fp); fputs("\t",fp); fputs(password,fp); fputs("\n",fp); } fclose(fp); }

/* Alphanumeric_Password_Generator Function. The function generates the passwords consisting of random numbers and letters on providing the password length */ void Alphanumeric_Password_Generator (int l) { int i,lp; time_t t; FILE *fp; char ch; fp=fopen("Password.txt","a+"); while(1) {

17

ch=fgetc(fp); if(ch==EOF) break; } srand((unsigned)time(&t)); for(i=0;i<l;i++) { lp=random(74)+48; if(lp>=91&&lp<=96||lp>=58&&lp<=64) { i--; continue; } printf("%c",lp); password[i]=(char)lp; } if(Compare(password)==0) { fputs(empname,fp); fputs("\t",fp); fputs(empid,fp); fputs("\t",fp); fputs(password,fp); fputs("\n",fp); }
18

fclose(fp); }

/*Compare Function This function checks whether the randomly generated passwords exists in the password text file or not. If it does not exists, the generated password is copied to the text file otherwise not. */ int compare(char *pass) { char cm[25]={NULL},cha[13]={NULL},b; int co,j=0,mp=1,i; FILE *pt; pt=fopen("Password.txt","r+"); b=fgetc(pt); while(b!=EOF) { co=0; j=0; fgets(cm,26,pt); for(i=0;i<strlen(cm)-1;i++) { if(co==2) { cha[j]=cm[i];

19

j++; } if(cm[i]=='\t') co++; } //printf("\n %s %s",pass,cha); if(strcmp(pass,cha)==0) { mp=2; break; } for(i=0;i<13;i++) { cha[i]='\0'; } b=fgetc(pt); } if(mp==1) return 0; else return 1; }

20

TEST CASES TEST 1.


Enter the emp name: Shashank Gupta Enter the empid: HCL214 Enter the length of the password between 8 and 12: 8 Type of password 1 : Numeric 2 : Alphabetic 3 : Alphanumeric Enter the type: 1 43687008

21

TEST 2

Enter the emp name: Sourav Gautam Enter the empid: HCL140 Enter the length of the password between 8 and 12: 10 Type of password 1 : Numeric 2 : Alphabetic 3 : Alphanumeric Enter the type: 2 MGYjuVAGAJ

22

TEST 3.

Enter the emp name: Sunny Singh Enter the empid: HCL234 Enter the length of the password between 8 and 12: 11 Type of password 1 : Numeric 2 : Alphabetic 3 : Alphanumeric Enter the type: 3 qHylqRwLDbJ

23

FILE PASSWORD.TXT:-

Shashank Gupta Sourav Gautam Sunny Singh

HCL214 HCL140 HCL234

43687008 MGYjuVAGAJ qHylqRwLDbJ

24

CONCLUSION AND EXTENSION


I developed the following project named Random Password Generator to provide a tool to a company for generating the passwords for its employees. The project is extremely easy to handle. Project will eliminate all the tedious paper work involved in maintaining the employees information. This project will provide a direct tool which will generate random passwords on providing the employees information and will save it in a text file. The passwords generated are quite secure and cannot be guessed easily. Also the numbers of passwords generated are quite large(5*3*24*60*60 =12,96,000) so every employees can be alloted a unique passwords very easily. Thus it will be beneficial for time management and for security purpose in a company.

The project can be further extended by making few maintainence such as - By including the 32 special symbols, 34 control characters and 128 graphics character for generating the password. - By storing the personal details of an individual in a separate file along with the password instead of storing all the details in a single file. - The generated password can be used by the employee to log into their private accounts to access company's information.

25

REFERENCES

1. 2. 3. 4. 5. 6.

7. 8.

www.wikipedia.org www.randpass.com www.smartdraw.com Wayne Stevens, Glen Myers, and Larry Constantine, Structured Design. IBM Systems Journal, May 1974. Tom DeMarco, Structured Analysis and Systems Specification. Englewood Cliffs, Petrocelli/Charter, 1975. Paul Ward, The Transformation Schema: An Extension of the Dataflow Diagram to represent Control and Timing. IEEE Transaction on Software Engineering, February 1986, pp. 198-210. www.google.com www.cyberciti.biz/faq/generating-random-password.

26

Das könnte Ihnen auch gefallen