Skip to content

feat(rfid): add fdxb_encode — FDX-B (ISO 11784/11785) animal-microchip LF block generator#77

Merged
xunholy merged 1 commit into
mainfrom
feat/fdxb-encode
Jun 21, 2026
Merged

feat(rfid): add fdxb_encode — FDX-B (ISO 11784/11785) animal-microchip LF block generator#77
xunholy merged 1 commit into
mainfrom
feat/fdxb-encode

Conversation

@xunholy

@xunholy xunholy commented Jun 21, 2026

Copy link
Copy Markdown
Owner

What

Adds fdxb_encode, the inverse of fdxb_decode (v0.464), extending the LF clone-generation set (em4100_encode, ioprox_encode, noralsy_encode, viking_encode, jablotron_encode, presco_encode) to the 134.2 kHz FDX-B animal/pet-microchip format. The decode side shipped long ago; the synth side was the open half noted in the gap-analysis LF-synth row. It produces the de-stuffed 10-byte ID+CRC block an authorized operator would feed a transponder writer to clone a tag.

How

internal/fdxb.Encode is the exact inverse of Decode: the same LSB-first field layout (38-bit national @ bit 0, 10-bit country @ bit 38, data-block + animal flag bits @ 48/49, reserved 50-63 zero) packed MSB-first into the 8-byte ID block, then the same Proxmark3 FDX-B CRC-16 (CCITT 0x1021, init 0, output-reflected) appended LSB-first. On-air framing and the 24-bit vendor extended block are out of scope, exactly as on decode. Generation only → Low risk.

Verification (inverse-generator pattern)

  • decode∘encode round-trip across six value sets — both of the decoder's real-tag anchors (528/140000795552, 999/1500030037), the 0/0 minimum, the 38-bit/10-bit maxima + both flags, and mid-range — each reproducing national/country/flags with a valid CRC (the shipped decoder is the independent oracle).

  • published-vector anchor: the identity bytes of the 528/140000795552 tag (bytes 0..6) reproduce that real tag's ID block byte-for-byte as 05D94D19042100. The real tag also carries a set reserved bit in byte 7 (bit 63, RFU range), which the canonical encoder zeroes — asserted and documented.

  • out-of-range national (>38 bits) / country (>10 bits, negative) rejected.

  • gofmt / go vet clean · golangci-lint run ./...0 issues · go test -race ./internal/fdxb/ ./internal/risk/ ./internal/tools/ok

  • registry 680→681, risk-consistency + gated-set tests green; multi-param panic guard auto-covers it.

Wired

internal/fdxb/{encode.go,encode_test.go}, internal/tools/fdxb_encode.go, risk.go (Low), registry_size_test.go (count + comment), gap-analysis LF-synth row.

…p LF block generator

The inverse of fdxb_decode (v0.464), extending the LF clone-generation set
(em4100_encode, ioprox_encode, noralsy_encode, viking_encode, jablotron_encode,
presco_encode) to the 134.2 kHz FDX-B animal/pet-microchip format. The decode
side shipped long ago but the synth side was the open half noted in the
gap-analysis LF-synth row; fdxb_encode produces the de-stuffed 10-byte ID+CRC
block an authorized operator would feed a transponder writer to clone a tag.

internal/fdxb.Encode is the exact inverse of Decode: the same LSB-first field
layout (38-bit national code at bit 0, 10-bit country at bit 38, the
data-block-status and animal-application flag bits at 48/49, reserved bits 50-63
zero) packed MSB-first into the 8-byte ID block, then the same Proxmark3 FDX-B
CRC-16 (CCITT poly 0x1021, init 0, output-reflected) appended LSB-first. The
on-air framing (11-bit preamble + the control '1' after every 8 bits) and the
24-bit vendor-specific extended block are out of scope, exactly as on the decode
side. Generation only — produces a block, transmits nothing and writes to no
device, so it is Low risk like the decoder.

Verification (the project's inverse-generator pattern): decode-of-encode
round-trips across six value sets — both of the decoder's real-tag anchors
(country 528 / national 140000795552 and country 999 / national 1500030037),
the 0/0 minimum, the 38-bit/10-bit maxima with both flags, and mid-range
values — each reproducing the national / country / flags with a valid CRC (the
shipped decoder is the independent oracle). Plus a published-vector anchor: the
identity bytes of the 528/140000795552 tag (national + country + flags, bytes
0..6) reproduce that real tag's ID block byte-for-byte as 05D94D19042100; the
real tag additionally carries a set reserved bit in byte 7 (bit 63, RFU range),
which the canonical encoder zeroes — asserted and documented. Out-of-range
national (>38 bits) and country (>10 bits, negative) are rejected.

Wired: internal/fdxb/{encode.go,encode_test.go}, internal/tools/fdxb_encode.go,
risk.go classification (Low, consistency test green), registry_size_test.go
680 -> 681 (count + comment), and the gap-analysis LF-synth row. gofmt /
go vet / golangci-lint (0 issues) / go test -race (fdxb, risk, tools) green.
@xunholy
xunholy merged commit d6c939a into main Jun 21, 2026
10 of 11 checks passed
@xunholy
xunholy deleted the feat/fdxb-encode branch June 21, 2026 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant