如何将助记符转换为32个字节种子?
我有一个24个字的助记符,我想将其转换为公共和私钥。
这就是我这样做的方式:
const hex = HexCoder.instance;
final seed = bip39.mnemonicToSeedHex(_mnmonic);
final algorithm = Ed25519();
// The hex.decode(seed) have 64 bytes lengths.
final keyPair = await algorithm.newKeyPairFromSeed(hex.decode(seed));
final newPublicKey = await keyPair.extractPublicKey();
但是我得到了这个错误:
参数(无效参数:种子必须具有32个字节)
我缺少什么?
I have a 24-word mnemonic, and I want to convert it to public and private keys.
This is how I did it:
const hex = HexCoder.instance;
final seed = bip39.mnemonicToSeedHex(_mnmonic);
final algorithm = Ed25519();
// The hex.decode(seed) have 64 bytes lengths.
final keyPair = await algorithm.newKeyPairFromSeed(hex.decode(seed));
final newPublicKey = await keyPair.extractPublicKey();
But I get this error:
ArgumentError (Invalid argument(s): Seed must have 32 bytes)
What am I missing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
更新
使用sha256:
旧答案
这里是另一个例子:
Update
Use sha256:
Old answer
Here are some examples how people generate keys from mnemonics:
Here is another example: