You are on page 1of 4

Sipna College of Engineering & Technology, Amravati

Department of Information Technology

Branch :- Information Technology Class :- III Year


Subject :- C&NS Sem :- VI
Manual

PRACTICAL NO. 4

Aim: Write a program to demonstrate authentication using password.


Software Required: Turbo C/C++

THEORY:
Password: -
Password have been used through history to verify someone’s identity by checking if they passes the
knowledge required to across something.

Authentication: -
Authentication is the process of recognizing a user’s identity. It is the mechanism of associating an incoming
request with a set of identifying credentials.

There are three factors of authentication: -


1) What you know:
Something you know, such as password, personal information
2) What you have:
A physical item you have such as a cell phone or card reader.
3) What you are:
Biometric data, such as finger print, retina scan, etc.
Password authentication falls into the “What you know” category and it is common form of authentication.
Implementation of Password: -
1) Authentication.
2) Registration with username and password.

IT/SEM-VI/C&NS/PR05 Page 1
Sipna College of Engineering & Technology, Amravati
Department of Information Technology

3) Enjoying password rules.


Example Password strength rules: -
1) Minimum 8 character.
2) At least one uppercase letter.
3) At least one number.
4) At least one special character.

Algorithm: -
Input: - Take username and password from user.
Output: - Display username, password more than 8 character which is marked.
Procedure: -
1) Take username as input and store it in the array username [].
2) Using for loop take each character a password as input and store it in the array password [] and
consecutive part as “*”.
3) Print the array password [] as output and exit.

Program: -

#include<stdio.h>

#include<conio.h>

#include<string.h>

void main()

char *username;

char *password;

clrscr();

IT/SEM-VI/C&NS/PR05 Page 2
Sipna College of Engineering & Technology, Amravati
Department of Information Technology

printf("Enter the username: ");

gets(username);

printf("\nEnter the password: ");

gets(password);

if(strcmp(username, "user") == 0){

//username verification sucessful

//next step is to verify the password

if(strcmp(password, "default") == 0){

//password verification also successful

printf("\nUser successfully logged in...");

}else{

//invalid password. Report it

printf("\nPassword entered is invalid");

}else{

IT/SEM-VI/C&NS/PR05 Page 3
Sipna College of Engineering & Technology, Amravati
Department of Information Technology

//invalid username. Report it

printf("\nUsername entered is invalid");

getch();

Output: -

Enter the username: user

Enter the password: default

User successfully logged in...

Conclusion: Thus, we have studied, program to demonstrate authentication using password.

IT/SEM-VI/C&NS/PR05 Page 4

You might also like