It looks like you're new here. If you want to get involved, click one of these buttons!
/*
___ ______________
\ \/ / _ \_ __ \
> < <_> ) | \/
/__/\_ \____/|__|
\/
*/
#include <conio.h>
#include <stdio.h>
#include <string.h>
#include <windows.h>
void SetColor(const int, const int);
void err(unsigned const int);
void main()
{
unsigned int c = 0;
char i, res;
char key[128], fn[128];
const char head[] = (
\"##################################\n\"
\" ##### #####\n\"
\" ##### Xor encoder #####\n\"
\" ##### for encoding #####\n\"
\" ##### text files #####\n\"
\" ##### #####\n\"
\" ##### Writen by s1n4 #####\n\"
\" ##### June 17 , 2011 #####\n\"
\" ##### 4:10 AM #####\n\"
\" ##### #####\n\"
\"##################################\n\n\");
FILE *input, *output;
SetColor(11, 0);
printf(head);
SetColor(7, 0);
printf(\"Please enter key >> \");
gets(key);
printf(\"Please enter filename >> \");
gets(fn);
if ((input = fopen(fn, \"rb\")) == NULL)
{
err(1);
}
i = getc(input);
if ((output = fopen(fn, \"wb\")) == NULL)
{
err(2);
}
while (i != EOF)
{
res = i ^ key[c];
putc(res, output);
i = getc(input);
if (c == strlen(key)-1)
{
c = 0;
continue;
}
c++;
}
fclose(output);
fclose(input);
SetColor(10, 0);
printf(key);
printf(\" xor \");
printf(fn);
getch();
exit(0);
}
void SetColor(const int foreground, const int background)
{
int Color = foreground + (background * 16);
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hConsole, Color);
}
void err(unsigned const int code)
{
SetColor(12, 0);
if (code == 1)
printf(\"Cannot open the file\");
if (code == 2)
printf(\"Cannot replace the file\");
getch();
exit(1);
}
#include <windows.h>
void SetColor(const int, const int);
SetColor(11, 0);
SetColor(7, 0);
SetColor(10, 0);
void SetColor(const int foreground, const int background)
{
int Color = foreground + (background * 16);
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hConsole, Color);
}
SetColor(12, 0);