ESP32-S3 Bench Guide
ESP32-S3 N16R8 bench guide: live pinout, lessons, simulators and the bench log.
MGM (RFC 9058) over Magma and Kuznyechik: per-block authentication coefficients, RFC test vectors, tampering, nonce reuse and the 64-bit data limits.
EducationTypeScript · HTMLGitHub @systemslibrarianOnlineOwner unconfirmed
Have you tried it? One tap is enough. No sign-in needed.
No updates detected yet. GitHub releases will appear here.
Owners of public repositories under a personal GitHub account can sign in to verify ownership and manage the introduction themselves. No administrator approval is needed.
Sign in, generate a verification file, and commit it to this repository’s default branch within 30 minutes. Files on other branches or forks do not count. Then check the file below to manage the project without administrator approval. Keep the file to retain your access.
If needed, you will go to sign-in. After signing in, return here and press your chosen verification button again.
Run /nomorevibe verify in your project folder to verify ownership and manage the introduction yourself.
Verify in one minuteAsk about other verification options
Browser-based MGM demo — the GOST AEAD mode of RFC 9058 over Magma and Kuznyechik, with a distinct authentication coefficient per block instead of GCM's single H, every RFC test value recomputed, a nonce-reuse panel, and why a 64-bit block re-keys sooner.
Taken from the repository README
Loading the full README. The saved excerpt is shown below.
Multilinear Galois Mode (RFC 9058) over Magma and Kuznyechik, in the browser, with every intermediate value shown and checked.Read the full README ↗Multilinear Galois Mode (RFC 9058) over Magma and Kuznyechik, in the browser, with every intermediate value shown and checked.
MGM is an authenticated-encryption (AEAD) block cipher mode from the Russian GOST standards, published in English as
RFC 9058. It encrypts in counter mode and authenticates with a multilinear
function: every authenticated block is multiplied, in GF(2^n), by its own coefficient H_i = E_K(Z_i) produced by
the block cipher from a second counter, the products are xored, and the sum is encrypted once more to give the tag.
GCM, by contrast, weights every block by a power of one hash subkey H. That difference is the subject of this lab.
The lab implements, in plain TypeScript with no runtime dependencies:
RFC 9058 is an Independent Submission, Informational: it documents a national standard and is not an IETF recommendation. Its real-world use is the GOST cipher suites for TLS 1.3, RFC 9367, itself also an Independent Submission.
This is a teaching demo, not production crypto. The implementations are written to be read, not to resist side channels: nothing here is constant-time, keys live in page memory, and the code has not been reviewed.
H, beside MGM's distinct H_i. Step
through the tag one block at a time: Z_i, H_i = E_K(Z_i), H_i ⊗ block, the running sum, the length block and
the final encryption. (The GCM column uses MGM's cipher and field to show the structure; it is not AES-GCM.)Y_i, E_K(Y_i), Z_i, H_i, running sum, the length block, the encrypted sum and the tag — beside
the value the RFC prints.C1 ⊕ C2 = P1 ⊕ P2, so knowing one message
reveals the other without the key. The verdict reads VERIFIED — AND LEAKED; a checkbox gives the second
message its own ICN as the control.3(s + 4q)² / 2^n for a chosen data volume, for both
block sizes, and the volume that keeps it under 2^-32 for each. Then RFC 9367's TLSTREE re-keying, with records
per key derived from each suite's C_3 constant: 8,192 for Kuznyechik-L, 128 for Magma-L, 8 and 1 for the S suites.id-tc26-gost-28147-param-Z. Swap two entries and watch the same key and block give a different cipher.H, because the difference is the mode's design argument.https://systemslibrarian.github.io/crypto-lab-mgm-mode/
Seal and tamper with messages, step through the tag computation, check the implementation against RFC 9058, reuse a nonce, and move the data-volume slider for both block sizes.
C1 ⊕ C2 = P1 ⊕ P2. MGM still verifies both messages; nothing it checks is wrong. (Exhibit 4.)H; MGM encrypts its sum before output, and this lab demonstrates
no forgery against it.MGM is standardised in Russia (R 1323565.1.026-2019) and used as the AEAD mode for GOST block ciphers in TLS 1.3
(RFC 9367, cipher suites TLS_GOSTR341112_256_WITH_{KUZNYECHIK,MAGMA}_MGM_{L,S}) and IPsec. RFC 9367's suites
re-key inside a connection through TLSTREE, more aggressively for Magma than for Kuznyechik.
npm ci
npm run dev # http://localhost:5173/crypto-lab-mgm-mode/
npm test # unit and known-answer tests
npm run test:a11y # WCAG gate (builds, then serves on port 4659)
npm run test:e2e # claims suite
pi tables. They cover every intermediate value of all four RFC 9058 Appendix A
examples (src/mgm/vectors.ts, extracted from the RFC text by scripts/extract-vectors.mjs, with the text's
sha256 recorded). They also cover tamper rejection at every byte, refusal of every forbidden input, the
RFC 7836 / RFC 8891 S-box cross-check, and the bound and TLSTREE arithmetic.C_3. They also cover the negative
claim's fixture and visibility, retirement and no-op guards, and the [hidden] probe.node scripts/mutations.mjs replays 10 source mutations and counts a kill only when the owning
test passed unmutated, the patch applied, the build succeeded with a changed bundle, and the test then failed.
10 of 10 are killed.The deploy workflow runs the unit tests, the build, the WCAG gate and the claims suite, and publishes only if all pass.
One of the browser demos in the Crypto Lab suite.
"So whether you eat or drink or whatever you do, do it all for the glory of God." — 1 Corinthians 10:31