Skip to content

Instantly share code, notes, and snippets.

@harieamjari
Last active July 1, 2020 14:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save harieamjari/5b04b4b0d81ac90fb59d2bf6d6a1498f to your computer and use it in GitHub Desktop.
Save harieamjari/5b04b4b0d81ac90fb59d2bf6d6a1498f to your computer and use it in GitHub Desktop.
From facebook
#include <stdio.h>
int
main(){
char tobe_encrypted[8];
printf("enter pin: ");
scanf("%s", tobe_encrypted);
char tmp;
char processed9[8];
for (int i = 0; i < 8; i++){
processed9[i] =
(char) (((9+(int)tobe_encrypted[i]-48)%10)+48);
}
printf("%s\n", processed9);
// swap first and fifth
tmp = processed9[0];
processed9[0] = processed9[4];
processed9[4] = tmp;
//swap second with sixth
tmp = processed9[1];
processed9[1] = processed9[5];
processed9[5] = tmp;
//swap third and seventh
tmp = processed9[2];
processed9[2] = processed9[6];
processed9[6] = tmp;
// fourth and eight
tmp = processed9[3];
processed9[3] = processed9[7];
processed9[7] = tmp;
printf("%.8s\n", processed9);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment