Appendix A Encrypting the log file
40
akytec GmbH - Vahrenwalder Str. 269 A - 30179 Hannover - Germany Tel.: +49 (0) 511 16 59 672–0 - www.akytec.de
Appendix A Encrypting the log file
When decrypting the log file, a hash function should be used as the initialization vector. The hash
function returns 8 bytes (type long long).
An example implementation of a hash function in C:
typedef union {
struct {
unsigned long lo;
unsigned long hi;
};
long long hilo;
}LONG_LONG;
long long Hash8(const char *str) {
// Based on Rot13
LONG_LONG temp;
temp.lo = 0;
temp.hi = 0;
for ( ; *str; )
{
temp.lo += (unsigned char) (*str);
temp.lo –= (temp.lo << 13) | (temp.lo >> 19);
str++;
if (!str) break;
temp.hi += (unsigned char) (*str);
temp.hi –= (temp.hi << 13) | (temp.hi >> 19);
str++;
}
return temp.hilo;
}