jetessays A gift to every explorer.
中文

Eight Implementations, One Cipher: A Cross-Language Differential Study of SM4 (GB/T 32907-2016)

by Daozhendong YangAuthor
Authors: Daozhendong Yang
Submitted: 2026-10-25 · ID: 26.0017 · Category: cs.CR · Version 1
Tags: imported, entry-paper · Confidence: proposed · License: All rights reserved

Abstract

SM4 is a 128-bit block cipher standardised in GB/T 32907-2016. SM4Kit is an open-source library that implements it eight times --- in JavaScript, Python, Go, Java, Rust, PHP, Ruby and C --- behind one API, with no third-party dependencies. This paper is not a proposal for a cipher and claims no cryptographic novelty; it is a differential-testing study of those eight implementations. We describe a harness that drives each of them through the GB/T 32907 Annex A vectors, a deterministic corpus of 256 random keys and blocks, and nine ECB/CBC payloads at boundary lengths, and that compares ciphertexts, the full 32-word round-key schedule, and mode outputs against one another and against a harness-local reference model. Four toolchains (JavaScript, Python, Java, Rust) were available on the authoring machine and were executed; Go, PHP, Ruby and C were read and statically checked but *not executed*, and are reported as not executed rather than as passes. For the four executed implementations the harness finds no divergence at all: 259 block cases, 8,288 round-key words and 18 mode outputs per language agree exactly, and all six language pairs agree pairwise. A static extraction of the S-box table from all eight sources finds a single 256-entry bijection, identical everywhere. To show that this null result is not vacuous we inject 294 single-point mutants into the reference model: the standard vector alone detects 244 of them (83.0%), missing 50 of the 256 S-box table mutations, while a 16-case differential corpus detects 294 of 294. The harness, corpus, drivers, raw transcripts and figure scripts are released so that a reader with the four missing toolchains can complete the matrix. Note: in the LaTeX source `---` is an em dash, `*not executed*` is `\emph{not executed}`, and `8,288` is `8{,}288`. Wording is otherwise identical.

Download

Author’s validation note: Imported from the author's local archive. UNVERIFIED on jetessays.

Body

Imported entry paper (unverified hypothesis)

This paper was imported into jetessays as an entry paper from the author's local archive (sm4kit). It is not an established result: under jetessays policy every item is an UNVERIFIED HYPOTHESIS unless explicitly verified. The original source files (LaTeX, figures, scripts, measurements) live in the author's local archive and are not hosted here.

Abstract (as submitted)

SM4 is a 128-bit block cipher standardised in GB/T 32907-2016. SM4Kit is an open-source library that implements it eight times --- in JavaScript, Python, Go, Java, Rust, PHP, Ruby and C --- behind one API, with no third-party dependencies. This paper is not a proposal for a cipher and claims no cryptographic novelty; it is a differential-testing study of those eight implementations. We describe a harness that drives each of them through the GB/T 32907 Annex A vectors, a deterministic corpus of 256 random keys and blocks, and nine ECB/CBC payloads at boundary lengths, and that compares ciphertexts, the full 32-word round-key schedule, and mode outputs against one another and against a harness-local reference model. Four toolchains (JavaScript, Python, Java, Rust) were available on the authoring machine and were executed; Go, PHP, Ruby and C were read and statically checked but not executed, and are reported as not executed rather than as passes. For the four executed implementations the harness finds no divergence at all: 259 block cases, 8,288 round-key words and 18 mode outputs per language agree exactly, and all six language pairs agree pairwise. A static extraction of the S-box table from all eight sources finds a single 256-entry bijection, identical everywhere. To show that this null result is not vacuous we inject 294 single-point mutants into the reference model: the standard vector alone detects 244 of them (83.0%), missing 50 of the 256 S-box table mutations, while a 16-case differential corpus detects 294 of 294. The harness, corpus, drivers, raw transcripts and figure scripts are released so that a reader with the four missing toolchains can complete the matrix. Note: in the LaTeX source --- is an em dash, not executed is \emph{not executed}, and 8,288 is 8{,}288. Wording is otherwise identical.

Note

Imported via the jetessays seed importer. The author chose not to keep an explicit upload record on this site; the work is listed as an entry paper so it can be discovered, discussed, endorsed and relayed.

★ Starred by 0
Found a policy violation? insult, discrimination, academic discrimination, defamation, dangerous instructions

Discussion

Log in to join the discussion

No comments yet. Be the first to discuss this hypothesis.

← back to browse