New to encryption
class CBlowFish
{
public:
//Constructor - Initialize the P and S boxes for a given Key
CBlowFish(unsigned char* ucKey, size_t n,
const SBlock& roChain = SBlock(0UL,0UL));
//Resetting the chaining block
void ResetChain();
// Encrypt/Decrypt Buffer in Place
void Encrypt(unsigned char* buf, size_t n, int iMode=ECB);
void Decrypt(unsigned char* buf, size_t n, int iMode=ECB);
// Encrypt/Decrypt from Input Buffer to Output Buffer
void Encrypt(const unsigned char* in, unsigned char* out,
size_t n, int iMode=ECB);
void Decrypt(const unsigned char* in, unsigned char* out,
size_t n, int iMode=ECB);
};
Here is my encryption code is use
//encryption code
UpdateData(TRUE);
char szDataOut[1024];
//Get length to use for padding must be multiple of 8
int nSize = m_szEdit.GetLength();
nSize = 8-(nSize%8)+nSize;
CBlowFish oBlwFsh((unsigned char*)(LPCTSTR)m_szKey, 8);
oBlwFsh.Encrypt((unsigned char*)(LPCTSTR)m_szEdit,
(unsigned char*)szDataOut, 800, CBlowFish::ECB);
m_szEdit = szDataOut;
UpdateData(FALSE);
The problem is when I decrypt my code it only decrypts so many bytes successfully then the rest is still encrypted. One thing I'm not sure of is once I open the file of text and go to decrypt it how do I know what to pass into the Decrypt() method size_t parameter? Is this the problem. I can't figure it out. Thanks in advance.
Jack

