Curve25519 KEY CLAMPING

This commit is contained in:
femsci 2023-11-11 15:59:08 +01:00
parent 431d286fd0
commit bb6d657ac8
Signed by: femsci
GPG key ID: 08F7911F0E650C67

View file

@ -72,6 +72,10 @@ impl PrivKey {
pub fn generate() -> Self {
let mut buf: [u8; 32] = [0; 32];
StdRng::from_entropy().fill_bytes(&mut buf);
//Curve25519 clamping
buf[0] &= 248;
buf[31] &= 127;
buf[31] |= 64;
PrivKey { data: buf }
}