Encryption & Decryption Using C
#include <stdio.h>
#include <string.h>
void encrypt(char str[],int key)
{
unsigned int i;
for(i=0;i<strlen(str);++i)
{
str[i] = str[i] - key;
}
}
void decrypt(char str[],int key)
{
unsigned int i;
for(i=0;i<strlen(str);++i)
{
str[i] = str[i] + key;
}
}
int main()
{
char str[] = "smurffANDkdo";
printf("Passwrod = %s\n",str);
encrypt(str,0xFACA);
printf("Encrypted value = %s\n",str);
decrypt(str,0xFACA);
printf("Decrypted value = %s\n",str);
return 0;
}
No comments:
Post a Comment