expansionPadding static method

String expansionPadding(
  1. String catalog,
  2. String key,
  3. int length
)

The padding expandPercent appends to one key's value: exactly length characters with a floor of 2, sliced from a fixed alphabet at an offset hashed from the key. Size it with expansionLength.

Fixed alphabet and a stable hash, because the export's byte-identical guarantee extends to budgets: two probe passes of an unchanged suite must flip the same sightings. The per-key offset keeps two keys' padding distinct (modulo the alphabet's length) — which budgets never need, and the attribution follow-up will.

Implementation

static String expansionPadding(String catalog, String key, int length) {
  if (length < 2) length = 2;
  var offset = _fnv('$catalog/$key') % _padAlphabet.length;
  var buffer = StringBuffer();
  for (var i = 0; i < length; i++) {
    buffer.write(_padAlphabet[(offset + i) % _padAlphabet.length]);
  }
  return buffer.toString();
}