Skip to content

Repository files navigation

GAN 251 Lab

A standalone browser tool for debugging GAN 251 (2×2) Bluetooth Low Energy behavior — live packet inspection, hardware decryption, virtual cube tracking, algorithm verification, and missed-move recovery.

Live: mrfanfo.github.io/GAN22LAB/


What it does

  • BLE Lab — connect a GAN 251 over Web Bluetooth, see every raw/decrypted packet in a live table (hex, CRC, decoded meaning, facelets, derived key/IV, timings)
  • Alg Tracker — follow an algorithm step-by-step; the tracker accounts for the GAN 251's anchor-corner frame drift so D is correctly mapped to a reported U, and frame changes after moves are applied automatically
  • Virtual 2×2 cube — 3D Three.js view driven by the live move/state stream
  • Missed-move recovery — detects BLE serial gaps and requests history from the cube to fill them in before emitting to the app
  • Orientation calibration — gyroscope quaternion pipeline with semantic face detection
  • Keyboard simulation — press U/R/F (Shift for prime) to inject synthetic moves without a physical cube


Architecture at a glance

Web Bluetooth (Chrome/Edge)
        │
   GanBleLab           ← generic GAN BLE layer (services, characteristics, notifications)
        │
  Gan251Session        ← decrypt → decode → update Virtual2x2Cube
        │
   PacketRow[]         ← rendered in the packet table (App.tsx)
        │
   AlgTracker
(known alg → deterministic anchor-frame verification)

Key source files:

File What it does
src/gan251/gan251Crypto.ts V3-2 AES/CBC decryption, MAC-based key derivation, CRC16
src/gan251/gan251PacketDecoder.ts Packet dispatch — move, state, history, telemetry
src/gan251/virtual2x2Cube.ts 2×2 corner model, move application, facelet encoding
src/gan251/gan251MoveRecovery.ts Serial-aware FIFO, gap detection, history request
src/lib/algTracker.ts 3×3 rotation-matrix frame model, deterministic step tracking
src/lib/gan251Moves.ts GAN251 move notation parsing and axis-collapse helpers
src/gan/ganBle.ts Raw BLE: connect, discover services, enable notifications
src/lib/gyro.ts Quaternion remapping, Three.js display orientation
src/lib/orientation.ts Semantic face detection from calibrated gyro

Manual MAC note

Web Bluetooth does not expose hardware MAC addresses — device.id is a browser opaque token. The MAC you enter manually stays in memory only and is used for V3-2 key/IV derivation and exported local logs. It is never transmitted anywhere.


Technical deep-dive

See docs/wiki.md for a complete explanation of the anchor-corner frame model, the AES/CBC encryption scheme, and every module in depth.

About

No description, website, or topics provided.

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages