Herunterladen Inhalt Inhalt Diese Seite drucken

Appendix A Verschlüsseln Der Protokolldatei - Akytec MU210-402 Bedienungsanleitung

Digitales ausgangsmodul
Inhaltsverzeichnis

Werbung

Appendix A Verschlüsseln der Protokolldatei
Appendix A Verschlüsseln der Protokolldatei
Beim Entschlüsseln der Protokolldatei sollte eine Hash-Funktion als Initialisierungsvektor verwendet
werden. Die Hash-Funktion gibt 8 Bytes zurück (Typ long long).
Eine beispielhafte Implementierung einer Hash-Funktion in C:
typedef union {
struct {
};
long long hilo;
}LONG_LONG;
long long Hash8(const char *str) {
temp.hi = 0;
for ( ; *str; )
{
}
return temp.hilo;
}
akytec GmbH - Vahrenwalder Str. 269 A - 30179 Hannover - Germany Tel.: +49 (0) 511 16 59 672–0 - www.akytec.de
unsigned long lo;
unsigned long hi;
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++;
// Nach
temp.lo = 0;
39

Werbung

Inhaltsverzeichnis
loading

Inhaltsverzeichnis