VARAHF.com / Quirks

Quirks in the VARA HF protocol

Measured effects of the generator’s reseed collisions and draw bias, and other oddities

1. Summary

Quirk Measured effect Matters in practice?
Reseeding keeps only 31 644 distinct states out of 32 768 seed remainders 6.86 % of seed values have exactly one twin; no two station hashes share a whole codebook No
Phase tables are drawn from 129 values onto a 128-step circle Phase 0 occurs twice as often as any other phase (1.55 % vs 0.78 %) No (a −42 dB bias)
Integer draws in general Uniform to within 7 parts per million No

All numbers in sections 2 and 3 are exact counts over every one of the generator’s 2^24 states, except where a sample of the real tables is quoted as a cross-check.

2. Reseed collisions

2.1 The mechanism

VARA reseeds its generator from an integer x in three steps: set the state from the bit pattern of the single-precision number −1 and advance once; mix the high 32-bit word of the double-precision number x mod 32768 into bits 8–23 of the state (mixed = (hi & 0xFFFF) xor (hi >> 16)); then advance x div 32768 + 1 times.

The mixing step folds 32 bits into 16, so different remainders can produce the same state.

2.2 How many collide

Count
Seed remainders (x mod 32768) 32 768
Distinct generator states they produce 31 644
Colliding groups 1 124, every one a pair
Remainders that have a twin 2 248 (6.86 %)
Examples of twins 4 and 16 387; 5 and 20 483; 6 and 24 579; 7 and 28 675; 32 and 8 193

Two seeds x and y give identical generator output when x div 32768 = y div 32768 and their remainders form one of these pairs. This is also why the seeds 43, 11 009 and 44 037 all produce the same per-level record tables.

2.3 What it means for callsigns

A station’s codebook is drawn from several seeds derived from station hashes: the session seeds (link seed + 10 + offset, +300, +1500) and the connect-request seeds (callee + offset + R), for both sides and all three formats: 30 distinct offsets in all.

3. Draw bias and the phase-table wrap

3.1 Integer draws

VARA draws a random integer as Int(Rnd × (n + 1)) in single precision, which returns 0 to n inclusive. Counted over all 2^24 generator states:

n Values Probability per value Largest relative error
1 0–1 0.5 0
4 0–4 0.2 2.4 × 10⁻⁷
5 0–5 0.1667 2.4 × 10⁻⁷
6 0–6 0.1429 3.4 × 10⁻⁷
128 0–128 0.00775 7 × 10⁻⁶

Single-precision rounding leaves the draws uniform to within a few parts per million.

3.2 The phase-table wrap

The PSK and OFDM phase tables hold phases in 128ths of a turn and are drawn with n = 128. That gives 129 possible values for a 128-step circle; the value 128 is a full turn and is stored as 0.

Exact Real OFDM table (60 032 entries) Real PSK table (6 123 entries)
Probability of phase 0 1.550 % (2/129) 1.569 % 1.39 %
Probability of each other phase 0.775 % (1/129) 0.775 % 0.776 %
Ratio 2.000 2.02 1.79

The tables were meant to scramble phases uniformly. The bias leaves a residual mean phasor of magnitude 0.00775, about −42 dB relative to one carrier. That is far too small to affect the peak-to-average ratio or the spectrum: an implementation must reproduce it to be compatible, but it costs nothing on air.

4. Other oddities

Oddity Effect
A timing product uses the double-precision constant 0.45, which is slightly above 0.45 Exact halves in the ACK-window calculation round up instead of to even; implementations must compute it the same way
Speed decisions are compared in single precision Implementations must use single precision to make the same decisions
Connect requests at 2750 Hz use the 2300 Hz tone family Harmless; every other 2750 Hz code uses its own family
The first KISS code is drawn twice: once in sequence with the session tone family, then again from a fixed seed with the 500 Hz family, which replaces the first draw The first draw is wasted; the result is that every station can decode this code, like the other broadcast codes
The lead-in is random rather than a known preamble Receivers cannot correlate on it; acquisition has to rely on pilots and markers
The interleavers are drawn from a 24-bit linear congruential generator rather than designed Whether this costs SNR is being measured against designed (QPP) interleavers
CQ SSIDs 16–19 overflow into the bandwidth field of the CQ frame A CQ from a callsign with SSID 16 at 500 Hz is received as the base callsign at 2300 Hz
No sideband detection In LSB the tones arrive mirrored and nothing decodes, with no indication (unconfirmed in the program itself; observed on air)
The QAM limit is taken as the last non-QAM row of the whole 17-row mode table, special rows included At 500 Hz that is a special row beyond the 13-level ladder, so the limit never applies there and stations may climb several levels at once into QAM; at 2300 and 2750 Hz it lands on the intended level
At 500 Hz, received frames are accepted on their CRC alone; the marker, terminator and header-shape checks run only at 2300 and 2750 Hz Harmless in practice; a frame from another session with a matching CRC would be accepted at 500 Hz
The header frame carries the sender’s encryption setting in two flag bits, and only certain stations can use it A protocol-level feature that is not documented anywhere public
The CWID ON/CWID OFF and WINLINK SESSION/P2P SESSION host commands do less than documented: the first pair has no effect, the second only switches a timing allowance Host programs cannot rely on the documented behaviour

5. Method

The counts in sections 2 and 3 come from a program that reproduces the generator bit for bit and walks all 2^24 states and all 2^24 station hashes. The real-table cross-checks use the tables the original modem builds at start-up.