About | NetLify | NeoCities | Project | TEST | 管理
EXES V6.0 LTS 跨平台自訂加密協議之設計與互通驗證:EXES-ChaCha512 512-bit 金鑰架構、1024-bit 內部狀態與 X60 Wire Format

<<Design and Cross-Platform Interoperability Evaluation of EXES V6.0 LTS: EXES-ChaCha512 with a 512-bit Key Architecture, 1024-bit Internal State, and X60 Wire Format>>

摘要 (Abstract)

本研究提出並實作 EXES (EXtended Encryption Standard) V6.0 LTS, 其目標是在 Visual Basic 6、早期 PHP、現代 JavaScript 與其他跨語言 runtime 之間,維持可重現、可驗證且 bit-for-bit 一致的加密 wire format。 V6.0 與 V5.x 刻意不相容,採用新的 X60 prefix,並以自訂 EXES-ChaCha512 流加密核心取代 V5.9.1 的標準 ChaCha20。

EXES-ChaCha512 保留 ChaCha 的 Add-Rotate-XOR quarter-round 與 16/12/8/7 rotation constants 作為設計基礎,可參考 ChaCha20 / RFC 8439ChaCha 設計論文; 但 V6 將 state 擴展為 32 × 32-bit = 1024 bits,其中包含 256-bit domain constants、512-bit encryption key、64-bit block counter 與 192-bit nonce, 每個 block 執行 10 個 double-round(20 rounds)並以 feed-forward 產生 128-byte keystream。因此 EXES-ChaCha512 是自訂 cipher construction,不是 RFC 8439 ChaCha20。

V6 以 HKDF / RFC 5869-SHA-512 分離 512-bit encryption key 與 512-bit MAC key,以 SHA-512 / FIPS 180-4 將 192-bit IV 導出 192-bit stream nonce, 並使用 HMAC / RFC 2104-SHA-512 產生完整 512-bit authentication tag,組合方式採 Encrypt-then-MAC 思路。 Base62 topology relation 則僅作為 X60 wire format 的 canonical/structural validation,不被視為 cryptographic integrity 的來源。

本次 V6 驗證包含 1,000 次功能/竄改樣本,以及 2,000 組固定 200-byte 規律明文的 ciphertext-payload 統計樣本。 在該次 3,216,000-bit 統計串流中,Shannon entropy 為 7.999570 bits/byte; Monobit、Byte Chi-square、Block Frequency、Cumulative Sums 與 Longest Run 的單批 p-value 均高於 α=0.01。 這些結果只代表實作一致性與樣本統計觀測,不構成 EXES-ChaCha512 具有「512-bit security」的形式化證明、第三方 cryptanalysis 或標準化認證。

命名說明:EXES 名稱中的 “Encryption Standard” 為專案命名;EXES V6.0 是自訂協議/wire format,而不是 NIST、IETF 或 ISO 已標準化的 cipher suite。

 

關鍵字 (Keywords)

EXES V6.0 LTS、EXES-ChaCha512、512-bit Key Architecture、1024-bit Internal State、X60 Wire Format、 HKDF-SHA-512、HMAC-SHA-512、Encrypt-then-MACBase62、跨語言互通、Legacy Systems、NIST SP 800-22 Rev. 1a

 

英文摘要 (English Abstract)

This study presents EXES (EXtended Encryption Standard) V6.0 LTS, a custom cross-platform encryption protocol designed to preserve reproducible and bit-for-bit interoperable ciphertext behavior across legacy and modern runtimes. V6.0 intentionally breaks compatibility with V5.x and introduces the X60 wire format together with a custom stream-cipher construction named EXES-ChaCha512.

EXES-ChaCha512 retains the ChaCha add-rotate-XOR quarter-round and its 16/12/8/7 rotation constants as design primitives, but expands the state to 32 32-bit words (1024 bits): 256 bits of domain constants, a 512-bit encryption key, a 64-bit block counter, and a 192-bit nonce. Ten double-rounds (20 rounds) are applied, followed by feed-forward, producing a 128-byte keystream block. Consequently, EXES-ChaCha512 is a custom construction and is not RFC 8439 ChaCha20.

HKDF-SHA-512 derives independent 512-bit encryption and MAC keys, SHA-512 derives a 192-bit stream nonce from the 192-bit IV, and HMAC-SHA-512 provides a full 512-bit authentication tag in an Encrypt-then-MAC-style composition. Base62 topology encoding is retained only for canonical structural validation of the X60 representation.

A V6 verification snapshot included 1,000 functional/tamper iterations and a 3,216,000-bit ciphertext-payload statistical sample generated from 2,000 encryptions of a fixed 200-byte plaintext with fresh Salt/IV values. Observed Shannon entropy was 7.999570 bits/byte, and the listed Monobit, byte Chi-square, Block Frequency, Cumulative Sums, and Longest Run p-values were all above alpha=0.01 in that single sample. These measurements provide implementation and statistical evidence only; they do not establish a formal 512-bit security claim for the custom EXES-ChaCha512 construction.

 

一、 背景 (Background)

企業與研究環境仍可能同時存在 Visual Basic 6、32-bit Windows、PHP 4-era 程式與現代瀏覽器/伺服器 runtime。 不同平台在 unsigned 32-bit arithmetic、UTF-8、CSPRNG、整數溢位與 API 可用性上存在差異,因此跨語言加密協議若只驗證「自己加密、自己解密」,仍可能隱藏 endian、overflow 或字元編碼不一致。

EXES V6.0 LTS 的核心研究問題因此是:在保留 legacy portability 的前提下,建立一個固定且可測試的 X60 wire format, 並以 deterministic test vector 強制所有 full port 在相同 plaintext、key、Salt 與 IV 下輸出逐字一致的 ciphertext。 V6 週邊仍使用 HKDF / RFC 5869SHA-512 / FIPS 180-4HMAC / RFC 2104 等標準原語,但 stream core 本身為自訂 EXES-ChaCha512。

JavaScript LTS 核心維持 ES5-style 語法,設計目標為 IE11 至現代 Chrome;現代瀏覽器使用 crypto.getRandomValues(), IE11 相容路徑使用 msCrypto.getRandomValues()。VB6 Windows XP~11 版使用 CryptoAPI CryptGenRandom, PHP 4.3.11~8.x 版保留 pure-PHP SHA-512/HMAC fallback。若可信 CSPRNG 不可用,EXES 採 fail-closed,不退回 Math.random()Rnd() 或一般用途 PRNG。

 

二、 動機 (Motivation)

V5.9.1 已將 V5.8 的 Dual-Sponge 與 264-bit 自訂 MAC 換成標準 ChaCha20、HKDF-SHA-512 與 HMAC-SHA-512; V6.0 則進一步把研究焦點移到「更大的自訂 stream-cipher state 與跨語言可重現實作」。 新版不再宣稱自己是標準 ChaCha20,而是明確命名為 EXES-ChaCha512,避免把 RFC 8439 的既有安全分析直接套用到不同 state topology 的新 construction。

V6 的設計動機包括:512-bit encryption-key architecture、1024-bit internal state、64-bit counter、192-bit nonce、 128-byte feed-forward output block,以及在 PHP 4-era / VB6 等 32-bit legacy runtime 中仍可用兩個 32-bit word 表示 64-bit counter。 這些是架構參數與工程目標,不是「已證明 512-bit security」的同義詞。

 

三、 目的 (Purpose)

本研究 V6.0 的主要目的如下:

  • 定義與分析 EXES-ChaCha512 的 1024-bit state layout、20-round topology、64-bit counter、192-bit nonce 與 128-byte feed-forward block。
  • 驗證 HKDF / RFC 5869-SHA-512 使用 EXES-V6.0-ENC-CHACHA512EXES-V6.0-MAC-HMAC512 label 產生兩組互相分離的 512-bit keys。
  • 驗證 nonce derivation:SHA-512(IV || "EXES-V6.0-NONCE-192")[0..23]
  • 確認 HMAC-SHA-512 對 X60 || Salt || IV || encrypted-length || padded-ciphertext 提供 512-bit tag,並在明文釋出前完成驗證。
  • 確認 Base62 topology 僅為 canonical wire encoding,不將其錯誤描述為 MAC 或安全證明。
  • 以 deterministic X60 vector 驗證 JavaScript、Python、Go、Java、Android-Java、C++、PHP、Ruby、Swift 的 bit-for-bit interoperability。
  • 維持 PHP 4.3.11~8.x 與 VB6 Windows XP~11 的 legacy source profiles,並清楚標記哪些平台已 runtime 驗證、哪些僅 source-audit。
  • 以功能、竄改、Unicode、錯誤金鑰、ciphertext 隨機性與統計檢定觀察實作品質,但不把結果等同於形式化 cryptanalysis。

 

四、 研究方法 (Methodology)

本研究以「規格固定 → deterministic vector → 多語言 differential validation → 動態測試」作為主要驗證流程。

4.1 EXES V6.0 / EXES-ChaCha512 核心資料流程

UTF-8 key material + 192-bit Salt
        │
        └─ HKDF-SHA-512
             ├─ info "EXES-V6.0-ENC-CHACHA512" ─► 512-bit ENC key
             └─ info "EXES-V6.0-MAC-HMAC512"   ─► 512-bit MAC key

192-bit IV
        └─ SHA-512( IV || "EXES-V6.0-NONCE-192" )[0..23]
                                               └─► 192-bit stream nonce

EXES-ChaCha512 state = 32 × 32-bit = 1024 bits
        ├─ words  0.. 7 : 256-bit domain constants
        ├─ words  8..23 : 512-bit encryption key
        ├─ words 24..25 : 64-bit block counter
        └─ words 26..31 : 192-bit nonce

10 double-rounds = 20 rounds
        ├─ 8 column quarter-rounds
        └─ 8 diagonal quarter-rounds (row offsets +1/+2/+3 mod 8)
               │
               └─ feed-forward ─► 128-byte keystream block

Plaintext ─► EXES-ChaCha512 XOR ─► padded ciphertext
                                      │
X60 + Salt + IV + encrypted length ───┼─► HMAC-SHA-512 ─► 512-bit tag
                                      │
                                      └─► Base62 topology wire encoding

Quarter-round 的 ADD/XOR/ROTATE 結構與 16/12/8/7 rotations 參考 ChaCha20 / RFC 8439; 然而 state layout、round topology 與 block size 已不同,因此 RFC 8439 的 ChaCha20 security analysis 不能直接視為 V6 的安全證明。

4.2 X60 Wire Format

X60 | Salt 192-bit (40 chars) | IV 192-bit (40 chars)
    | Encrypted Length (10 chars)
    | Ciphertext (5 chars / padded 3 bytes)
    | HMAC-SHA-512 Tag (110 chars)

固定 overhead(不含 ciphertext groups)為 203 chars。 每個 24-bit value 以 5 個 Base62 字元表示,canonical relation 為 expanded = val * 54 + (val % 54)。 解碼器會拒絕不符合 relation 的五字元組;這是結構驗證,不取代 HMAC-SHA-512。

4.3 跨平台實作策略

  • JavaScript:ES5-style core;不依賴 Promise、BigInt、TextEncoder/TextDecoder 或 crypto.subtle。CSPRNG 使用 Web Crypto / msCrypto。
  • PHP:目標 PHP 4.3.11~8.x;保留 PHP 4-era syntax、pure-PHP SHA-512/HMAC fallback、32-bit arithmetic;V6 64-bit counter 拆成兩個 32-bit words。
  • VB6:目標 Windows XP~11;SHA-512/HMAC/HKDF/EXES-ChaCha512/strict UTF-8 為純 VB6,CSPRNG 使用 advapi32.dll CryptoAPI。
  • Unicode:跨語言以 UTF-8 / RFC 3629 為共同 byte representation;非法 UTF-8 與未配對 surrogate 應 fail-closed。

4.4 Deterministic Cross-Language Vector

固定 plaintext=TEST、固定測試 key、Salt=00..17、IV=18..2f 時, 所有 runtime-verified full ports 必須產生完全相同的 X60... ciphertext。

顯示固定 X60 測試向量
X60003dO0imOH1RV8I2ADtB2swe43bfOx4KO9q536uj5lpek6UYPd7DHAW7vzvP8eigI9NRRBA6ABCAosw5TBls10ywzqen3D7bphCZp3nPSg2hkRImK6RvymWWqkuzxxcypDqCqISjR6zIPONiOS3ICupbDjbPyRRzcf2hDJx284lEXeHDmkjYmOadiNLNeDmEUanfOcGZ7oONzS1L0O

4.5 動態測試與統計方法

  • 功能測試:Round-trip、wrong key、Body/Header tamper、Unicode、NUL byte、ciphertext uniqueness 等。
  • 統計樣本:固定 200-byte 規律明文、固定 key、每次 fresh CSPRNG Salt/IV;只統計 decoded ciphertext payload,排除 X60 metadata 與 HMAC tag。
  • 統計項目:Shannon entropy、Monobit、Block Frequency、Cumulative Sums、Longest Run 與 byte Chi-square;本次 α=0.01。
  • SAC 方法限制:若每次呼叫 encrypt() 都使用不同 Salt/IV,兩組 ciphertext 的 50% 差異不能直接視為 cipher-core 的正式 Strict Avalanche Criterion。正式 SAC 應固定 Salt/IV/nonce 與其餘參數,只翻轉單一指定輸入 bit。
  • 記憶體:統計 counters 可使用 O(1) 額外記憶體;full-message 加解密本體仍需 O(n) plaintext/ciphertext buffers。

4.6 跨語言驗證狀態

已 runtime 驗證並重現相同 X60 vector:JavaScript/Node 22.16、Python 3.13.5、Go 1.23.2、Java 21、Android-Java JVM profile、C++11/g++ 14.2、 PHP 8.4.23(原生 SHA/HMAC 與 forced pure fallback)、Ruby 3.3.8、Swift 6.2.1。 C#、VB.NET、PowerShell、VB6 Windows XP~11 與 x86-64 NASM core 為 source-audited。 PHP 4.3.11 與 Windows XP/VB6 舊平台因本建置環境沒有相應 runtime/compiler,應描述為 source compatibility target,不能寫成實機 PASS。

 

五、 研究結果 (Results)

以下為 V6 canonical JavaScript core 於 2026-08-10 重新產生的驗證快照;此數據取代文件中原先屬於 V5.9.1 的統計與效能數值。

5.1 Self-Test 與功能性樣本

  • SHA-512 KAT:PASS
  • HMAC-SHA-512 KAT:PASS
  • HKDF-SHA-512 KAT:PASS
  • 192-bit nonce derivation KAT:PASS
  • EXES-ChaCha512 core KAT:PASS
  • X60 full protocol deterministic vector:PASS
  • 1,000 次功能樣本:Round-trip failure 0、wrong-key accepted 0、Body tamper accepted 0、Header tamper accepted 0、duplicate ciphertext 0、Unicode/NUL failure 0。

5.2 V6 Ciphertext Payload 統計快照

方法:2,000 次加密;plaintext 固定為 200 bytes 的 A;key 固定;每次使用 fresh CSPRNG Salt/IV; 僅抽取 X60 的 ciphertext payload,排除 prefix、Salt、IV、encrypted-length 與 HMAC tag。

Payload bytes / bits402,000 bytes / 3,216,000 bits
Shannon entropy7.999570 bits/byte
Bit-one ratio49.970958%
Monobit p-value0.297577
Byte Chi-square p-value0.747615 (df=255)
Block Frequency p-value0.864088 (M=128, N=25,125)
Cumulative Sums p-valueForward 0.189363 / Reverse 0.262620
Longest Run p-value0.042076 (M=10,000, N=321)
Significance thresholdα = 0.01

上述單批樣本中列出的 p-value 均 ≥ 0.01,未觀察到這些檢定所描述的簡單統計異常。 依 NIST SP 800-22 Rev. 1a 的使用原則,統計測試不能取代 cryptanalysis;高 entropy 或 p-value 通過亦不能證明 cipher construction 安全。

5.3 跨語言互通結果

JavaScript、Python、Go、Java、Android-Java profile、C++、PHP、Ruby、Swift 已在可用 runtime 中以相同 plaintext/key/Salt/IV 重現完全相同的 X60 ciphertext。 PHP 8.4.23 另外強制 pure-PHP SHA-512/HMAC fallback,仍重現相同 vector。

5.4 尚未納入的數據

原文件的 KDF/init 0.60 ms2271 KB/s4711 KB/s 等數值屬 V5.9.1 舊量測,本版已移除。 V6 performance 應在研討會實際展示硬體、指定瀏覽器/runtime 上重新量測並註明 CPU、OS、browser/runtime version。

 

六、 研究發現 (Findings)

依 V6.0 現行程式與跨語言測試,可歸納以下實作層發現:

  1. EXES-ChaCha512 是新的 custom core:它借用 ChaCha quarter-round,但 state 從 16 words 擴展為 32 words,round topology 與 output block 也不同,因此不能把 RFC 8439 ChaCha20 的安全結論直接搬到 V6。
  2. 512-bit key / 1024-bit state 是設計參數:它們描述 key width 與 state size,不等同「EXES 整體已證明 512-bit security」。真正的 security strength 仍需公開 cryptanalysis、攻擊複雜度分析與輸入 key entropy 支持。
  3. HKDF key separation:ENC/MAC 分別使用 EXES-V6.0-ENC-CHACHA512EXES-V6.0-MAC-HMAC512 context,避免同一 raw key 直接跨用途使用。
  4. Authenticate before release:解密端先重算並 constant-time 比較 HMAC-SHA-512 tag,通過後才將 plaintext 回傳給呼叫端。
  5. Base62 topology 是 parser/canonical layer:val*54+(val%54) 可拒絕部分非法表示,但不應稱為 MAC、防破解或 security proof。
  6. Deterministic cross-language vector 是重要 regression gate:它能抓出 endian、32-bit overflow、UTF-8 與 legacy runtime 的實作差異,比單純 round-trip 更有互通驗證價值。

6.1 安全邊界與限制

  • 自訂 cipher construction:EXES-ChaCha512 尚未取得與標準 ChaCha20 相同程度的公開分析,不應宣稱已達成或證明 512-bit security。
  • 輸入 key entropy:即使 ENC key derivation 輸出 512 bits,若使用者提供的實際 password/key material entropy 較低,整體暴力破解上限仍被輸入 entropy 限制。
  • 41-char Base62 範例 key:若 41 字元真的均勻隨機,其理論 entropy 約 244 bits,因此不能因 V6 core 使用 512-bit key 就把該使用情境稱為 512-bit key-search resistance。
  • HKDF 不是 password-hardening KDF:對低 entropy 人類密碼,可在 EXES 前級研究 Argon2 / RFC 9106 等 memory-hard password KDF;HKDF 的主要工作是 extract/expand 與 key separation。
  • SAC 測試限制:fresh Salt/IV 的兩次 ciphertext 差異主要同時包含隨機化效果;正式 avalanche 測試需要 deterministic/fixed-nonce test harness。
  • 統計測試限制:單批 NIST-style p-value 與 entropy 不等同安全證明。
  • Legacy 驗證範圍:PHP 4.3.11 與 VB6/Windows XP 是 source compatibility target,目前沒有在該實際舊 runtime 上執行,因此研討會文件必須明確揭露。
  • IE11 範圍:JavaScript core 依 ES5 syntax 與 msCrypto.getRandomValues() 路徑設計;目前驗證屬 static/API-path audit,不應寫成 IE11 實機認證。

 

七、 未來可延伸研究 (Future Work)

V6.0 後續研究可聚焦於下列方向:

  • 獨立 cryptanalysis:針對 4×8 state topology 進行 differential、linear、rotational、related-key、time-memory tradeoff 與 distinguishers 分析。
  • 正式 avalanche harness:增加可固定 Salt/IV/nonce/counter 的 deterministic 測試介面,只翻轉單一 plaintext/key bit,再計算 SAC/BIC。
  • 標準 AEAD baseline:以 RFC 8439 ChaCha20-Poly1305 作為對照組,比較 custom V6 在 legacy portability、wire overhead、效能與 failure behavior 的差異,而不是把兩者視為同一演算法。
  • 密碼前級強化:研究 Argon2 / RFC 9106 等 password-hardening 方法,區分 machine-generated 512-bit key material 與 human password threat model。
  • 後量子 key establishment:可研究以 ML-KEM / FIPS 203 建立共享 secret,再交由 EXES 對稱層處理;這與把 KEM 直接嵌入 stream core 是不同問題。
  • WebAssembly現代瀏覽器可考慮 WASM 加速 SHA-512 / EXES-ChaCha512;IE11 則維持 ES5 fallback,以 wire compatibility 為共同邊界。
  • Fuzzing 與 differential testing:對 X60 parser、Base62 canonical validation、Unicode、length field 與錯誤路徑做跨語言 fuzzing。
  • 舊平台實機驗證:建立 PHP 4.3.11、Windows XP + VB6 SP6 與實際 IE11 VM,補齊目前 source-audit-only 的證據。

 

八、 參考文獻 (References)

Conference package SHA-256: ab68ac10af50b6193dd3fd19d39443f01577fd6c9bacbd7baa8f0b377fd2c241

 

九、 相關附件:實機環境操作與稽核步驟

欲重現本頁 V6.0 研究流程,可依下列步驟執行:

  1. 步驟一:確認 V6 核心與 Audit Tool
    使用套件中的 javascript/exes.jsaudit/utility_exes_v600_real_stats.html。 Audit dashboard 使用現代 JavaScript UI,因此建議 Chrome / Edge / Firefox;V6 cipher core 的 IE11 ES5 相容目標與 audit dashboard 的瀏覽器需求要分開描述。
  2. 步驟二:確認版本識別
    EXES_VERSION 應為 6.0EXES_WIRE_PREFIX 應為 X60,並先執行 exesSelfTest()。 V5.x ciphertext 不應被 V6 解密器接受。
  3. 步驟三:執行功能與竄改測試
    驗證 round-trip、wrong key、Body/Header tamper、truncate/extend、Unicode、NUL byte、空密碼/空明文 fail-closed 等行為。 Promise-based concurrent calls 主要檢查重入/共享狀態;JavaScript 同步 core 本身不是 Web Worker 多執行緒。
  4. 步驟四:執行 ciphertext-payload 統計
    統計器只解析 X60 + 90-char header + payload + 110-char HMAC tag 中的 payload bytes, 再計算 Shannon entropy、Monobit、Block Frequency、Cumulative Sums、Longest Run 與 Byte Chi-square。
  5. 步驟五:正確解讀 SAC
    若測試程式每次加密都重新產生 Salt/IV,S03/S04 類「50% ciphertext difference」只能視為 protocol-output difference heuristic, 不應寫成正式 SAC 證明。正式 avalanche test 應固定 Salt/IV/nonce/counter,只改變單一 input bit。
  6. 步驟六:產出研討會報告
    報告中使用「PASS / 本次樣本未觀察到異常」等措辭,並揭露 samples、runtime、CPU/OS/browser 與工具版本; 不使用「SECURE 工業級安全」、「100% immunity」、「已證明 512-bit security」等超出證據範圍的結論。

EXES V6.0 LTS 本次驗證摘要

Canonical wire prefixX60
ENC key / Internal state512-bit / 1024-bit
IV / Derived nonce192-bit / 192-bit
MACHMAC-SHA-512, full 512-bit tag
Functional sample1,000 iterations; 0 round-trip / wrong-key / Body tamper / Header tamper / Unicode failures in this sample
Statistical stream402,000 payload bytes / 3,216,000 bits
Shannon entropy7.999570 bits/byte
Monobit p-value0.297577
Byte Chi-square p-value0.747615
Block Frequency p-value0.864088
CumSums F/R0.189363 / 0.262620
Longest Run p-value0.042076
Cross-language runtime vectorJS / Python / Go / Java / Android-Java JVM / C++ / PHP / Ruby / Swift PASS
Legacy source targetsPHP 4.3.11~8.x;VB6 Windows XP~11(舊 runtime 實機尚未驗證)

Interpretation:上述結果表示目前 V6 實作在指定測試樣本中沒有觀察到上述功能性錯誤與簡單統計異常; 但 EXES-ChaCha512 是自訂 cipher construction,這些結果不構成 512-bit security 的證明。

 

Jplopsoft | THI | Netlify | NeoCities | LionFree

加密工具 | 提交歸檔 | QRCODE產生器 | 密碼產生器

アクセスカウンター