Skip to content

Instantly share code, notes, and snippets.

@sei0o

sei0o/mask.c Secret

Created May 24, 2020 05:28
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 sei0o/7964d1ddda6e460a3175cee292992f2c to your computer and use it in GitHub Desktop.
Save sei0o/7964d1ddda6e460a3175cee292992f2c to your computer and use it in GitHub Desktop.
mask
#include <stdio.h>
#include <string.h>
#define MASK1 0b01110101
#define MASK2 0b11101011
int main(int argc, char **argv) {
int i;
char s[64], t[64], u[64];
if (argc == 1) {
printf("Usage: ./mask [FLAG]\n");
return 0;
}
strcpy(s, argv[1]);
int len = strlen(s);
printf("Putting on masks...\n");
for (i = 0; i < len; i++) {
t[i] = s[i] & MASK1;
u[i] = s[i] & MASK2;
}
t[len] = '\0';
u[len] = '\0';
printf("%s\n", t);
printf("%s\n", u);
if (!strcmp(t, "atd4`qdedtUpetepqeUdaaeUeaqau") && !strcmp(u, "c`b bk`kj`KbababcaKbacaKiacki")) {
printf("Correct! Submit your FLAG.\n");
} else {
printf("Wrong FLAG. Try again.\n");
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment