Create a Password Protected Program in C

Password Protected C Program is not a myth or we can say that it is true that we can make a protected program in the C language.It can help us to protect our other programs which is important for us.


This article will show you that how you can make a password protected C program in the Turbo C++ compiler.
I think you never ever heard about this type of trick.

So today I am going to show you this technique.

Password protecting C Program Code

//header file to use function of string array
#include<string.h>

//Initialisation of global variables


char name[]="howtohack";   //name by entering program run without password
char passs[]="permission";  //password to run program goes here
int count=1;
char namech[20],passsch[15],ync;

/* To print the following pattern

*
**
***
****
*****

*/


  /****** Source code to make it password protected ******/

void star()
{
   int i,j;
   clrscr();   /* To clear the previous runned program */

      for(i=0;i<5;i++)   /* Outer loop for counting lines */
       {
  for(j=0;j<=i;j++)   /* Inner loop for printing stars */
   {
printf("*");
   }
printf("\n");
       }

   getch();   /* Make you see the output until you press any key */
   exit(0);
}

 void pass()    //This is the program to make password protected
 {
   printf("\nEnter your name: ");
    gets(namech);
     if(strcmpi(name,namech)==0)
      {
star();   //our function name which we want to password protected
      }
     else
      {
printf("\nHello! %s did you know the password");
printf("\nPress y for yes & n for no: ");
 ync=getch();
     if(ync=='y'||ync=='Y')
      {
printf("\nEnter pasword: ");
 gets(passsch);
  if(strcmpi(passs,passsch)==0)
   {
     star();
   }
  else
   {
      printf("\nThanks For Running");
   }
      }
      }
 }


// Our Main program

void main()
 {
   clrscr();
    ync='y';
     for(count=1;count<=3;count++)
      {
if(ync=='n'||ync=='N')
{
  getch();
   exit(0);
}
else
{
  pass();
   if(ync=='y'||ync=='Y')
     printf("%d Chance Terminated",count);
}
      }
   getch();
 }


The implementation of the above code can be shown in the below video.
 Just watch carefully.I know after this you will learn how to protect your any C program with the password.

So lets Start:-



After watching this video you will be able to perform this task and may protect your important and the confidential programs form the password.This trick can seriously helps us to secure our code .

Through this we can protect multiple programs or the projects as simply copy all of the above stuff and used it into every project which is required to give the security to it.








Share on Google Plus

About howtohack

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment

0 comments: