I have trouble with DES algorithm. How to solve this?
(I'm using DevC++ v5.11)
I don't completely understand what DES are. What should I do/try ?
// Triple DES (3DES)
void DES::inital_key(const char key[64],char ekey[16][48],bool is_crypt)
{
union{ //Error here
char pkey[56];
struct{char l[28],r[28];};
};
permute(key,pkey,_DES::perm1,56);
for(uint n=0; n<16; n++) {
lshift(l,_DES::sc[n]);
lshift(r,_DES::sc[n]);
permute(pkey,ekey[is_crypt?n:15-n],_DES::perm2,48);
}
}
/////////////////////////////////////////////////////////////////////////////
void DES::work(const char in[64],char out[64],const char key[64],bool is_crypt)
{
char ekey[16][48];
union{ //And here
char pin[64];
struct{char l[32],r[32];};
};
inital_key(key,ekey,is_crypt);
permute(in,pin,_DES::perm3,64);
for(uint n=0; n<16;) round(l,r,ekey[n++]),round(r,l,ekey[n++]);
permute(pin,out,_DES::perm6,64);
}