/* ------------------------------------------------------------------------------ Bob Jenkins, 1996, Public Domain char.c: figure out the characteristics of a mixing function ------------------------------------------------------------------------------ */ #ifndef STANDARD #include "standard.h" #endif #ifndef BIT #include "bit.h" #endif #ifndef RECYCLE #include "recycle.h" #endif #ifndef GAUSS #include "gauss.h" #endif #ifndef MIX #include "mix.h" #endif #ifndef RAND #include "rand.h" #endif #define MAXBASE 8 #define TESTSIZE 256 #define SEEDS 4 /* Set up equations. * pre[i] is the preimage delta when seeds differ in bit i alone. * post[i] is the postimage delta when seeds differ in bit i. * eqn[i] is twice as long as pre[i] and post[i]. The first half * is the xor of pre[i] and post[i]. The second half is a copy * of pre[i]. * We'll be doing Gaussian elimination on eqn[]. Characteristics * will be eqn's where the first half is all zero but the second * half isn't. Those characteristics for a basis of the space of * all characteristics; by XORing them together we can get all other * characteristics. */ static void setup( seed, pre, post, eqn, rctx) bitvec *seed; bitvec **pre; bitvec **post; bitvec **eqn; randctx *rctx; { bitvec this[MAKEBIT(MIXSIZE)]; bitvec that[MAKEBIT(MIXSIZE)]; word i; /* Choose a seed */ for (i=0; i