Pure-MoonBit crypto & CTF toolbox (a port of ToolsFx): national crypto SM2/SM3/SM4 (GB/T 32905/32907/32918, byte-for-byte standard vectors), encoding toolkit (Base16/32/58/58Check/62/64/85/91, Punycode, URL, radix, QP, UU/XX), classical ciphers with ciphertext auto-detection, and a single-JSON-dispatch workbench shared by the browser frontend and the moon run demo.
Dependencies
| Capability 能力 | Status 状态 |
|---|---|
| Encoding toolkit 编码工具库 | ✅ released (v0.2.0) |
| Classical ciphers + auto-detect 古典密码 + 自动识别 | ✅ released (v0.2.0) |
| SM3 (one-shot + streaming) | ✅ GB/T 32905 App.A vectors |
| SM4 (ECB/CBC/PKCS7/CTR/GCM) | ✅ GB/T 32907 vector + RFC 8452 GHASH cross-check |
| SM2 keygen / sign / verify / encrypt / decrypt (raw + DER, C1C3C2/C1C2C3) | ✅ GM/T 0003.5 Annex A vectors (byte-for-byte) |
| JSON dispatch + registry (49 routes) | ✅ 10 native e2e tests |
| Browser workbench + GitHub Pages | ✅ auto-deployed from main |
moon run cmd/demo -- sm3 abc
# 66c7f0f462eeedd9d1f2d46bdc10e4e24167c4875cf2f7a2297da02b8f4ba8e0
moon run cmd/demo -- caesar_encode Hello --shift=3 # Khoor
moon run cmd/demo -- vigenere_encode ATTACKATDAWN --key=LEMON
moon run cmd/demo -- detect "Gur dhvpx oebja sbk whzcf bire gur ynml qbt"
moon run cmd/demo -- sha256 abc
moon run cmd/demo -- sm4_encrypt secret --mode=cbc \
--key_hex=0123456789abcdeffedcba9876543210 \
--iv_hex=000102030405060708090a0b0c0d0e0f| Operation | ~time |
|---|---|
| SM3 (short message) | ~0.04 ms |
| SM2 sign / verify | ~11 / ~10 ms |
| SM2 decrypt | ~5 ms |
| Project 项目 | License 许可 | Relationship 关系 |
|---|---|---|
| ToolsFx (Leon406) | ISC | Behavior-aligned port source 行为对齐移植来源 |
| mooncry (cc06b) | Apache-2.0 | General crypto dependency 通用密码原语依赖 |
| toolsfx-moonbit (this project) | ISC | — |
moon check --deny-warn # native (needs a C toolchain)
moon test --deny-warn --target wasm-gc # full suite (193 tests)
moon build web --target js # browser bridge for the workbenchPure-MoonBit crypto & CTF toolbox (a port of ToolsFx): national crypto SM2/SM3/SM4 (GB/T 32905/32907/32918, byte-for-byte standard vectors), encoding toolkit (Base16/32/58/58Check/62/64/85/91, Punycode, URL, radix, QP, UU/XX), classical ciphers with ciphertext auto-detection, and a single-JSON-dispatch workbench shared by the browser frontend and the moon run demo.
Dependencies