--TEST-- Check that generated triple-des keys have the correct parity. --FILE-- generateSessionKey(); for ($i = 0; $i < strlen($k); $i++) { $byte = ord($k[$i]); $parity = 0; while ($byte !== 0) { $parity ^= $byte & 1; $byte >>= 1; } if ($parity !== 1) { printf("Parity mismatch on position %d. Key was %s.\n", $i, bin2hex($k)); exit(1); } } } echo "OK\n"; ?> --EXPECTF-- OK