Add bambu-nfc dump parse, Key-A HKDF, and spool merge.

Parse filanfc-dump/v1 zip/JSON, Bambu 1K images, and merge stickers by tray UID. dump and mifare packages stay importable for a later common library.
This commit is contained in:
2026-08-23 15:23:11 -05:00
parent a794db4838
commit b38f7f643b
29 changed files with 893 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
// Package mifare holds MIFARE Classic 1K layout helpers with no brand-specific memory map.
package mifare
import "fmt"
const (
Sectors = 16
Blocks = 64
BlockSize = 16
SectorSize = 64
Size1K = 1024
)
// SectorOf returns the sector index for a block number (063).
func SectorOf(block int) int {
return block / 4
}
// BlockRange returns the half-open block range [first, last) for a sector.
func BlockRange(sector int) (first, last int) {
first = sector * 4
last = first + 4
return first, last
}
// SectorBytes returns the 64-byte slice for sector (015) from a 1K image.
func SectorBytes(image []byte, sector int) ([]byte, error) {
if len(image) != Size1K {
return nil, fmt.Errorf("image size: want %d got %d", Size1K, len(image))
}
if sector < 0 || sector >= Sectors {
return nil, fmt.Errorf("sector %d out of range", sector)
}
off := sector * SectorSize
return image[off : off+SectorSize], nil
}