Skip to content

Instantly share code, notes, and snippets.

@yohanes
Created October 26, 2014 12:39
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 yohanes/863c6fb19326e95c4170 to your computer and use it in GitHub Desktop.
Save yohanes/863c6fb19326e95c4170 to your computer and use it in GitHub Desktop.
Pwnium.c
#include <ctype.h>
#include <string.h>
#include <stdio.h>
char secret_code[] = "B1lR]c5r]Qsqfg";
void alter_digit(char *s)
{
for (int i = 0; i < strlen(s); ++i)
{
if (isdigit(s[i]))
{
int x = 10;
// x += 4 * 3;
x -= 7;
s[i] = s[i] ^ x;
}
}
}
void rotate(char *s)
{
char aux;
int n = strlen(s);
for (int i = 0; i < n / 2; ++i)
{
aux = s[i];
s[i] = s[n - i - 1];
s[n - i - 1] = aux;
}
}
int main(int argc, char const *argv[])
{
// rotate(secret_code);
for (int i = 0; i < strlen(secret_code); ++i)
{
// if (i % 2 == 0)
// secret_code[i] -= 2;
// else
secret_code[i] += 2;
}
alter_digit(secret_code);
puts(secret_code);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment