Skip to content

Commit

Permalink
improve new key generation performance
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-orlovsky committed Jun 23, 2024
1 parent ce77fb7 commit 9f419b3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/ed25519.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,14 @@ impl Ed25519Secret {
let pair = KeyPair::from_seed(Seed::generate());
let pk = pair.pk;

if pk[30] != u8::from(Algo::Ed25519) || pk[31] != u8::from(chain) {
continue;
}

let sig = pair.sk.sign("test", Some(Noise::generate()));
pk.verify("test", &sig).expect("unable to create key");

if pk[30] == u8::from(Algo::Ed25519) && pk[31] == u8::from(chain) {
return Self(pair.sk);
}
return Self(pair.sk);
}
}

Expand Down

0 comments on commit 9f419b3

Please sign in to comment.