how to encrypt and decrypt a data in c

 #include<stdio.h>


void encrypt(char *c){

   char *ptr = c;

   while(*ptr!= '\0'){

    *ptr = *ptr + 2;

    ptr++;

   }

}

int main()

{

char c[] = "nilabhru come on amd fuck me";

encrypt(c);

printf("Encrypted string is: %s",c);

return 0;

}



#include<stdio.h>


void decrypt(char *c){

   char *ptr = c;

   while(*ptr!= '\0'){

    *ptr = *ptr - 2;

    ptr++;

   }

}

int main()

{

char c[] = "pkncdjtw eqog qp cof hwem og";

decrypt(c);

printf("Decrypted string is: %s",c);

return 0;

}

Comments

Popular posts from this blog

create a num table in a new file in c

write a programme to compare time stamp in c

write a struct programme to keep bank details in c