Curve25519 KEY CLAMPING
This commit is contained in:
parent
431d286fd0
commit
bb6d657ac8
1 changed files with 4 additions and 0 deletions
|
@ -72,6 +72,10 @@ impl PrivKey {
|
||||||
pub fn generate() -> Self {
|
pub fn generate() -> Self {
|
||||||
let mut buf: [u8; 32] = [0; 32];
|
let mut buf: [u8; 32] = [0; 32];
|
||||||
StdRng::from_entropy().fill_bytes(&mut buf);
|
StdRng::from_entropy().fill_bytes(&mut buf);
|
||||||
|
//Curve25519 clamping
|
||||||
|
buf[0] &= 248;
|
||||||
|
buf[31] &= 127;
|
||||||
|
buf[31] |= 64;
|
||||||
PrivKey { data: buf }
|
PrivKey { data: buf }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue