Salut à tous!
Je vous explique mon problème: j'ai commencé une petit programme de cryptage tout simple (je débute...

) seulement voila cela fonctionne nickel sur des fichiers texte mais sur des fichiers bitmap par exemple sans que j'arrive à comprendre pourquoi le cryptage ne s'effectue pas jusqu'au bout (à vrai dire il me manque à peu près 99,9% du fichier une fois decrypté

)
Alors voila je vous met le code de ma classe cryptage si quelqu'un d'entre vous pourrai éclairer ma lanterne je lui serai très reconnaissant!
PS: je met toute la source mais le problême intervient pendant l'exécution de la méthode crypter()
class CryptageSimple
{
public:
CryptageSimple(char* cle, char* chemin1, char* chemin2)
{
keylen=strlen(cle);
key=new char[keylen] ;
strcpy(key, cle);
int len=strlen(chemin1);
path=new char[len];
strcpy(path,chemin1);
len=strlen(chemin2);
path2=new char[len];
strcpy(path2,chemin2);
};
bool crypter()
{
char line[1];
unsigned int a;
unsigned char b;
int i=0;
ifstream f(path);
ofstream ff(path2);
if(i>=keylen) i=0;
f.read( line, 1 ) ;
b=line[0];
a=(int)b;
a+=(int)key[i];
a=a%255;
b=a;
i++;
while(!f.eof())
{
ff<<b;
if(i>=keylen) i=0;
f.read( line, 1 ) ;
b=line[0];
a=(int)b;
a+=(int)key[i];
a=a%255;
b=a;
i++;
}
ff<<b;
cout<<"Opération effectuée";
return 0;
};
bool decrypter()
{
char line[1];
int a;
unsigned char b;
int i=0;
ifstream f(path);
ofstream ff(path2);
if(i>=keylen) i=0;
f.read( line, 1 ) ;
b=line[0];
a=(int)b;
a-=(int)key[i];
a=a%255;
b=(char)a;
i++;
while(!f.eof())
{
ff<<b;
if(i>=keylen) i=0;
f.read( line, 1 ) ;
b=line[0];
a=(int)b;
a-=(int)key[i];
a=a%255;
b=(char)a;
i++;
}
cout<<"Opération effectuée";
return 0;
};
private:
int keylen;
char* key;
char* path;
char* path2;
};