mirror of
https://github.com/ziglang/zig.git
synced 2026-02-21 16:54:52 +00:00
Fix typo in an old comment, and avoid useless hash
This commit is contained in:
parent
1ca3a48b87
commit
2dba5eaa64
@ -274,18 +274,18 @@ fn Kyber(comptime p: Params) type {
|
||||
g.update(&pk.hpk);
|
||||
g.final(&kr);
|
||||
|
||||
// c = innerEncrypy(pk, m, r)
|
||||
// c = innerEncrypt(pk, m, r)
|
||||
const ct = pk.pk.encrypt(&m, kr[32..64]);
|
||||
|
||||
// Compute H(c) and put in second slot of kr, which will be (K', H(c)).
|
||||
sha3.Sha3_256.hash(&ct, kr[32..], .{});
|
||||
|
||||
if (p.ml_kem) {
|
||||
return EncapsulatedSecret{
|
||||
.shared_secret = kr[0..shared_length].*, // ML-KEM: K = K'
|
||||
.ciphertext = ct,
|
||||
};
|
||||
} else {
|
||||
// Compute H(c) and put in second slot of kr, which will be (K', H(c)).
|
||||
sha3.Sha3_256.hash(&ct, kr[32..], .{});
|
||||
|
||||
var ss: [shared_length]u8 = undefined;
|
||||
sha3.Shake256.hash(&kr, &ss, .{});
|
||||
return EncapsulatedSecret{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user