gauge

package
v0.7.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 22, 2026 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package gauge models the global affine gauge ambiguity that shows up when a byte-oriented obfuscator's state is recovered from output only: the recovered high byte and multiplier are pinned just up to an affine change of coordinates (Mg·x + Cg with Mg odd, hence invertible mod 256). The gauge group is small — 128 odd multipliers × 256 offsets = 32,768 elements — so it can be brute-forced in full, which is what the alias "gauge" recovery mode does to look for a coordinate frame in which a clean closed form appears.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ModInv

func ModInv(a uint8) uint8

ModInv returns the multiplicative inverse of an odd byte mod 256. It panics on an even input, which has no inverse.

Types

type Gauge

type Gauge struct {
	Mg uint8 // must be odd (invertible mod 256)
	Cg uint8
}

Gauge is the affine change of coordinates (Mg odd, Cg). It acts on the high byte as Hi → Mg·Hi + Cg and on the multiplier as Mul → Mg·Mul, both mod 256.

func All

func All() []Gauge

All returns every gauge: 128 odd multipliers × 256 offsets = 32,768.

func (Gauge) FromTrue

func (g Gauge) FromTrue(s State) State

FromTrue maps a true-coordinate state back into gauge coordinates. It is the exact inverse of ToTrue.

func (Gauge) ToTrue

func (g Gauge) ToTrue(s State) State

ToTrue maps a gauge-coordinate state into true coordinates.

type State

type State struct {
	Hi  uint8 // high byte (observable at even positions)
	Mul uint8 // odd multiplier
}

State is the per-character FSM state of the kind the alias subject exposes: an observable high byte and an odd multiplier byte.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL