rust 使用 ed25519 生成秘钥 #9
-
我想使用 rust 生成一堆 ed25519 的秘钥对,rust 里 使用的是 ed25519-dalek。 extern crate rand;
extern crate ed25519_dalek;
use rand::rngs::OsRng;
use ed25519_dalek::Keypair;
use ed25519_dalek::Signature;
let mut csprng = OsRng{};
let keypair: Keypair = Keypair::generate(&mut csprng); 我在我电脑上编译的时候,报错如下: 似乎是 OsRng 的问题。 版本信息: ed25519-dalek = "1" 尝试更换过其他的rand,依然报错,怎么找一个符合条件的 Rng ? |
Beta Was this translation helpful? Give feedback.
Answered by
DaviRain-Su
Jun 14, 2023
Replies: 2 comments
-
https://github.com/DaviRain-Su/all-in-one-rust/blob/main/ed25519-example/src/lib.rs |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
v1xingyue
-
rand版本换一下就行了 ed25519-dalek v1.0.1 依赖rand0.7.0 [dependencies] |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://github.com/DaviRain-Su/all-in-one-rust/blob/main/ed25519-example/src/lib.rs