I've created a simple Program to store and Retrieve the Passwords whenever I want.
For example, I have one password which is Pass
so its binary will be 01010000011000010111001101110011
. I've created a program that will convert it to binary and will store it in the file. The Program is as given Below:
#include<stdio.h>
#include<conio.h>
#include<string.h>
main()
{
FILE *fptr;
char wname[100];
char uname[100];
char pass[100];
char str[50];
char bin[7];
int c2n,i,ii;
clrscr();
printf("\nEnter website name: ");
fflush(stdin);
gets(wname);
printf("\nEnter the username: ");
fflush(stdin);
gets(uname);
printf("\nEnter password: ");
fflush(stdin);
gets(pass);
fptr=fopen("DND","a");
printf("Binary of entered string is : ");
fprintf(fptr,"\n");
for(i=0;i<=strlen(wname)-1;i++)
{
c2n=wname[i];
for(ii=7;ii>=0;ii--)
{
bin[ii]=c2n%2;
c2n=c2n/2;
}
for(ii=0;ii<=7;ii++)
{
printf("%d",bin[ii]);
fprintf(fptr,"%d",bin[ii]);
}
}
printf(":");
fprintf(fptr,":");
for(i=0;i<=strlen(uname)-1;i++)
{
c2n=uname[i];
for(ii=7;ii>=0;ii--)
{
bin[ii]=c2n%2;
c2n=c2n/2;
}
for(ii=0;ii<=7;ii++)
{
printf("%d",bin[ii]);
fprintf(fptr,"%d",bin[ii]);
}
}
printf(":");
fprintf(fptr,":");
for(i=0;i<=strlen(pass)-1;i++)
{
c2n=pass[i];
for(ii=7;ii>=0;ii--)
{
bin[ii]=c2n%2;
c2n=c2n/2;
}
for(ii=0;ii<=7;ii++)
{
printf("%d",bin[ii]);
fprintf(fptr,"%d",bin[ii]);
}
}
fclose(fptr);
printf("\n Your website name,user name and password are protected in binary....\nPress any key to close coder......");
getch();
return 0;
}
Now, I want to create Decoder for this.I want a program to convert all the binary to one sentence. For example.
01010000011000010111001101110011
=Pass
I have no Idea how to create it.