My picHere i was presented with a small challenge. I wanted to create a small library in C to be able to encrypt any size of file of any type. It had to be written striclty ANSI cause i wanted it to compile under any C/C++ compiler.

So i came up with a library that will handle the whole process and as a demo with 4 more programs in two pairs encrypt/decrypt to use them with simple text files and encrypt_bin/decrypt_bin to use them over binary files of any type. Here is the list of funtions provided:

crypt_block *encrypt(char *in, char *key);
char *decrypt(crypt_block *encrypted, char *key);
crypt_block *encrypt_bin(crypt_block *in, char *key);
crypt_block *decrypt_bin(crypt_block *in, char *key);
char *read_plain_file(const char *filename);
crypt_block *read_encrypted_file(const char *filename);
void save_encrypted_file(crypt_block *out, char *filename);
void save_plain_file(char *out, char *filename);

With these functions anyone can handle any file, encrypt and decrypt it with a simple (almost unbreakable) xor encryption. I released the package for download at my site.
For any problem report back to me

/me out