ksjsb/docs/superpowers/plans/2026-07-10-core-signing-algorithms.md
2026-07-30 20:25:56 +08:00

2.4 KiB

Core Signing Algorithms Implementation Plan

For agentic workers: REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (- [ ]) syntax for tracking.

Goal: Move the recovered signing/encryption algorithms into a reusable core package.

Architecture: Keep proven algorithm code intact first, then expose narrow modules by responsibility: sig, tokensig, sig3, xfalcon, enc_data, and reward_sign. Existing out/* scripts remain usable through compatibility imports.

Tech Stack: Python 3.13, stdlib only.


Task 1: Create core package skeleton

Files:

  • Create: core/__init__.py

  • Create: core/constants.py

  • Create: core/sig.py

  • Create: core/tokensig.py

  • Create: core/sig3.py

  • Create: core/xfalcon.py

  • Create: core/enc_data.py

  • Create: core/reward_sign.py

  • Create modules with focused exports.

  • Keep table file paths pointing at existing out/*.bin artifacts.

  • Validate imports with python -m py_compile core\*.py.

Task 2: Move xfalcon implementation

Files:

  • Create: core/xfalcon_blake_core.py

  • Create: core/xfalcon_te.py

  • Modify: core/xfalcon.py

  • Copy the verified BLAKE2s-style compression and $TE_ formatter.

  • Adjust relative imports to stay inside core.

  • Verify with existing xfalcon tests.

Task 3: Move KWSG 10400/10418 implementation

Files:

  • Create: core/kwsg.py

  • Modify: core/sig3.py

  • Modify: core/enc_data.py

  • Modify: core/reward_sign.py

  • Copy the verified ks_sign.py implementation.

  • Adjust xfalcon imports to core.xfalcon.

  • Expose category modules as stable public entrypoints.

Task 4: Compatibility and call sites

Files:

  • Modify: out/analyze_live_reward_log.py

  • Modify: out/build_followup_request.py

  • Modify: out/ks_sign.py only if needed

  • Prefer importing from core in request builders.

  • Preserve old command behavior for existing scripts.

  • Avoid touching dynamic probe scripts.

Task 5: Verification

Commands:

python -m py_compile core\*.py out\analyze_live_reward_log.py out\build_followup_request.py out\build_reward_request.py out\run_reward_cycle.py
python out\test_rebuild_xfalcon_digest.py
python out\test_rebuild_xfalcon_reward.py
python out\test_build_reward_request.py
python out\test_live_reward_log.py

Expected: all commands exit 0.