Um código escrito por THINK3R , Soma de 2 bytes não pode resultar em mais de 255b.
/**************************************************************
* *
* BESCA *
* Based Equation System Cryptographic Algorithm *
* *
* Written by : TH1NK3R *
* *
* Year : 2009 *
* *
* Email : cnwfhguohrugbo@gmail.com *
* *
* Compile with: *
* gcc -o bin besca.c -Wall *
* *
* *
* TODO: *
* *
* Sum of 2 bytes cannot to result more than 255b. So *
* we need to solve this problem, thinking a solution *
* for this problem. *
* *
**************************************************************/
/** Sorry, my english is poor :S */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
int f_help(char *nome)
{
printf("[+]--------------------------------------------------------------------------[+]\n");
printf("\n");
printf("Usage: %s <entrada> <saida> <0/1>\n",nome);
printf("\n");
printf(" <entrada> Arquivo que será (en/de)criptar\n");
printf(" <saida> Arquivo final\n");
printf(" <0/1> 0 - Encriptar\n");
printf(" 1 - Decriptar\n");
printf("\n");
printf(" » Coded by TH1NK3R «\n");
printf("[+]--------------------------------------------------------------------------[+]\n");
return(0);
}
int main(int argc, char *argv[])
{
unsigned int g=0, i=0;
signed int a,b,c,d;
char *infile, *outfile;
FILE *fdo, *fds;
if (argc < 4) {
f_help(argv[0]);
return(-1);
}
/*****************/
infile = argv[1];
outfile = argv[2];
g = atoi(argv[3]);
/*****************/
fdo = fopen(infile,"r");
fds = fopen(outfile,"w+");
if ( (fdo == NULL) || (fds == NULL) ) {
printf("[-] Erro ao abrir arquivo(s)\n");
return(-1);
}
/*****************/
while( (a = fgetc(fdo)) != EOF ) {
if ( (b = fgetc(fdo)) == EOF ) {
fputc(a,fds);
//printf("%c [%d]\n",a,a);
i += 1;
break;
}
if (!g) {
if (a >= b) {
c = a+b;
d = a-b;
} else {
d = b+a; /* c */
c = b-a; /* d */
/* c = b+a;
d = b-a; */
}
} else {
if (a >= b) {
c = (a+b)/2;
d = a-c;
} else {
d = (a+b)/2;
c = b-d;
}
}
i += 2;
fputc(c,fds);
fputc(d,fds);
//printf("%c [%d] --> [%d] %c\n",a,a,c,c);
//printf("%c [%d] --> [%d] %c\n",b,b,d,d);
}
printf("\n");
printf("[»] %d bytes %s!\n",i,(!g) ? "encripted" : "decrypted");
fclose(fdo);
fclose(fds);
return(0);
}
/** EoF */


Últimos Comentários