2 个不稳定版本

1.0.0 2021年8月28日
0.2.0 2021年8月29日
0.1.1 2021年8月24日
0.1.0 2021年8月24日

7#bip39


seed-utils 使用

MIT 许可证

12KB
116

seed-xor

seed-xor 基于 rust-bip39 构建,允许您使用 Coldcards 文档中描述的方法对 bip39 辅助词进行 XOR 操作。

还可以对单词数量不同的辅助词进行 XOR 操作。为此,较短的辅助词将通过较长的辅助词的冗余熵进行扩展。

示例

use seed_xor::Mnemonic;
use std::str::FromStr;

// Coldcard example: https://github.com/Coldcard/firmware/blob/master/docs/seed-xor.md
let a_str = "romance wink lottery autumn shop bring dawn tongue range crater truth ability miss spice fitness easy legal release recall obey exchange recycle dragon room";
let b_str = "lion misery divide hurry latin fluid camp advance illegal lab pyramid unaware eager fringe sick camera series noodle toy crowd jeans select depth lounge";
let c_str = "vault nominee cradle silk own frown throw leg cactus recall talent worry gadget surface shy planet purpose coffee drip few seven term squeeze educate";
let result_str = "silent toe meat possible chair blossom wait occur this worth option bag nurse find fish scene bench asthma bike wage world quit primary indoor";

// Mnemonic is a wrapper for bip39::Mnemonic which implements the XOR operation `^`.
// Mnemonics can also be created from entropy.
let a = Mnemonic::from_str(a_str).unwrap();
let b = Mnemonic::from_str(b_str).unwrap();
let c = Mnemonic::from_str(c_str).unwrap();
let result = Mnemonic::from_str(result_str).unwrap();

assert_eq!(result, a ^ b ^ c);

有用的资源

依赖项

~560KB
~25K SLoC