C program to encrypt and decrypt a password
#include
<stdio.h>
#include
<string.h>
void
encrypt(char password[],int key)
{
unsigned int i;
for(i=0;i<strlen(password);++i)
{
password[i] = password[i] - key;
}
}
void
decrypt(char password[],int key)
{
unsigned int i;
for(i=0;i<strlen(password);++i)
{
password[i] = password[i] + key;
}
}
int
main()
{
char password[20] ;
printf("Enter the password: n ");
scanf("%s",password);
printf("Passwrod = %sn",password);
encrypt(password,0xFACA);
printf("Encrypted value =
%sn",password);
decrypt(password,0xFACA);
printf("Decrypted value =
%sn",password);
return 0;
}