#include "DarkGDK.h";
#include <stdio.h>;
#include <stdlib.h>;
#define low_prn 32
#define high_prn 129
char* scramble_text(char* string,char *code);
char* unscramble_text(char* string,char *code);
void DarkGDK ( void )
{
char mystring[12],codestring[8];
strcpy(mystring,"Hello World");strcpy(codestring,"BaNaNas");
dbPrint(mystring);
strcpy(mystring,scramble_text(mystring,codestring));
dbPrint(mystring);
strcpy(mystring,unscramble_text(mystring,codestring));
dbPrint(mystring);
while (dbEscapeKey()==0){
dbSync();
}
return;
}
char* scramble_text(char* string,char* code)
{
int idx=0,idx2=0,ch,lgth,intcode;
while (idx<int(strlen(string)))
{
intcode=int(*(code+idx2));
ch=int(*(string+idx));
*(string+idx)=char(ch+intcode);
if (int(*(string+idx))>high_prn)
{
*(string+idx)=char(high_prn%intcode);
*(string+idx)=char(int(*(string+idx))+low_prn);
}
idx++;idx2++;
if (idx2>int(strlen(code))){idx2=0;}
}
lgth=idx-1;
return string;
}
char* unscramble_text(char* string,char* code)
{
int idx=0,idx2=0,ch,lgth,intcode;
while (idx<int(strlen(string)))
{
intcode=int(*(code+idx2));
ch=int(*(string+idx));
*(string+idx)=char(ch-intcode);
if (int(*(string+idx))<low_prn)
*(string+idx)=char(high_prn%intcode);
idx++;idx2++;
if (idx2>int(strlen(code))){idx2=0;}
}
lgth=idx-1;
return string;
}
The Working code for anyone interested it. (Encryption Algorythm)
fubar