Skip to content

Commit b294ea7

Browse files
authored
doc(README): include MLKEM
1 parent 2d7b1da commit b294ea7

5 files changed

Lines changed: 17 additions & 13 deletions

File tree

README-EN.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ ShangMi (SM) cipher suites for Golang, referred to as **GMSM**, is a secure, hig
4040

4141
- **DRBG** - Random Number Generation Using Deterministic Random Bit Generators, for detail, please reference **NIST Special Publication 800-90A** and **GM/T 0105-2021**: CTR-DRBG using derivation function and HASH-DRBG. NIST related implementations are tested with part of NIST provided test vectors. It's **NOT** concurrent safe! You can also use [randomness](https://github.com/Trisia/randomness) tool to check the generated random bits.
4242

43+
- **MLKEM** - NIST FIPS 203 Module-Lattice-Based Key-Encapsulation Mechanism Standard.
44+
4345
- **MLDSA** - NIST FIPS 204 Module-Lattice-Based Digital Signature Standard.
4446

4547
- **SLHDSA** - NIST FIPS 205 Stateless Hash-Based Digital Signature Standard

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ Go语言商用密码软件,简称**GMSM**,一个安全、高性能、易于
5353

5454
- **DRBG** - 《GM/T 0105-2021软件随机数发生器设计指南》实现。本实现同时支持**NIST Special Publication 800-90A**(部分) 和 **GM/T 0105-2021**,NIST相关实现使用了NIST提供的测试数据进行测试。本实现**不支持并发使用**
5555

56+
- **MLKEM** - NIST FIPS 203 Module-Lattice-Based Key-Encapsulation Mechanism Standard实现,基于Golang标准库,支持所有三组参数集(ML-KEM-512/ML-KEM-768/ML-KEM-1024)。
57+
5658
- **MLDSA** - NIST FIPS 204 Module-Lattice-Based Digital Signature Standard实现。
5759

5860
- **SLHDSA** - NIST FIPS 205 Stateless Hash-Based Digital Signature Standard实现。

mlkem/mlkem1024.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mlkem/mlkem512.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mlkem/mlkem768.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ import (
3535

3636
const (
3737
// ML-KEM global constants.
38-
n = 256
39-
q = 3329
38+
n = 256
39+
q = 3329
4040
maxBytesOf64Mulη = 192
4141

4242
// encodingSizeX is the byte size of a ringElement or nttElement encoded
@@ -56,9 +56,9 @@ const (
5656

5757
// ML-KEM-768 parameters.
5858
const (
59-
k = 3
60-
η1 = 2
61-
η2 = 2
59+
k = 3
60+
η1 = 2 // eta1
61+
η2 = 2 // eta2
6262

6363
CiphertextSize768 = k*encodingSize10 + encodingSize4
6464
EncapsulationKeySize768 = k*encodingSize12 + 32
@@ -67,7 +67,7 @@ const (
6767

6868
// ML-KEM-512 parameters.
6969
const (
70-
k512 = 2
70+
k512 = 2
7171
η1_512 = 3
7272
η2_512 = 2
7373

@@ -78,7 +78,7 @@ const (
7878

7979
// ML-KEM-1024 parameters.
8080
const (
81-
k1024 = 4
81+
k1024 = 4
8282
η1_1024 = 2
8383
η2_1024 = 2
8484

@@ -93,7 +93,7 @@ type DecapsulationKey768 struct {
9393
d [32]byte // decapsulation key seed
9494
z [32]byte // implicit rejection sampling seed
9595

96-
ρ [32]byte // sampleNTT seed for A, stored for the encapsulation key
96+
ρ [32]byte // rho, sampleNTT seed for A, stored for the encapsulation key
9797
h [32]byte // H(ek), stored for ML-KEM.Decaps_internal
9898

9999
encryptionKey
@@ -265,7 +265,7 @@ func kemKeyGen(dk *DecapsulationKey768, d, z *[32]byte) {
265265
g.Write(d[:])
266266
g.Write([]byte{k}) // Module dimension as a domain separator.
267267
G := g.Sum(make([]byte, 0, 64))
268-
ρ, σ := G[:32], G[32:]
268+
ρ, σ := G[:32], G[32:] // rho, sigma
269269
dk.ρ = [32]byte(ρ)
270270

271271
A := &dk.a

0 commit comments

Comments
 (0)