Task #1 - Decryptor

The following C code implements a function that encrypts a buffer using a simple scheme. Develop the corresponding decryption function in C and use it to decrypt the string @ehndil

You can verify your code by submitting the decrypted string via the form on the self-test page.

#include <sys/types.h>

#define KEY 0x0f

int encrypt(u_char* buf, int len) {
register int i;

if (!buf) return 0;

for (i = 0 ; i < len; ++i)
buf[i] = (buf[i] ^ KEY) + i;

return i;
}

Questions

mail to: lambertz@cs.uni-bonn.de