void hashin_update(void) { static word hash_seed; /* secret xor seed */ word *buf; /* pointer to hashin */ int i; off_t hashin_off; buf = (word *) hashin; i = hashin_off = 0; if (options.seclevel) read(random_source, &hash_seed, sizeof(hash_seed)); /* get a new seed */ while (i++ < (hashin_size / sizeof(hash_seed))) buf[i] ^= hash_seed; } void hashout_update(void) { short int rbytes; char *rres, *rbuf; __u64 res[3], *buf, *bufend; buf = (__u64 *) buffer; bufend = buf + (buffer_size / sizeof(__u64)); while (buf < bufend) { if ((buf+3) >= bufend) /* don't go too far */ { rbytes = (int) ((void *) bufend - (void *) buf); /* the (void *) prevents scaling */ break; /* not enough room */ } hashin_update(); tiger(hashin, hashin_size, buf); /* zero copy */ buf += 3; /* tiger outputs three 64bit values */ } if (rbytes) { rbuf = (char *) buf; rres = (char *) res; hashin_update(); tiger(hashin, hashin_size, res); while (rbytes--) *rbuf++ = *rres++; /* yes, that increments the pointers */ } }