Crates.io | pktseed |
lib.rs | pktseed |
version | 0.1.1 |
source | src |
created_at | 2021-08-28 15:07:02.514066 |
updated_at | 2021-08-28 15:52:40.140137 |
description | Wallet seed support for PktWallet style seeds |
homepage | |
repository | https://github.com/cjdelisle/pktseed |
max_upload_size | |
id | 443467 |
size | 181,143 |
This is the seed algorithm used in PktWallet.
use rand::Rng;
use pktseed::{Seed, SeedEnc};
fn main() {
let mut rng = rand::thread_rng();
let seed = Seed::new(rng.gen::<[u8; 17]>());
let seed_enc = seed.encrypt(Some(b"password"));
println!("Encrypted seed words: {}", seed_enc.words("english"));
}
use rand::Rng;
use pktseed::{Seed, SeedEnc};
fn main() {
let mut rng = rand::thread_rng();
let seed = Seed::new(rng.gen::<[u8; 17]>());
let seed_enc = seed.encrypt(None);
println!("Unencrypted seed words: {}", seed_enc.words("english"));
}
use pktseed::SeedEnc;
fn main() {
let seed_enc = SeedEnc::from_words(
"mom blanket bulk draw clip wolf bread erupt merry skin cable infant word exchange animal",
).unwrap();
println!("Is seed encrypted? {}", seed_enc.is_encrypted());
}
use pktseed::SeedEnc;
fn main() {
let seed_enc = SeedEnc::from_words(
"mom blanket bulk draw clip wolf bread erupt merry skin cable infant word exchange animal",
).unwrap();
let seed = seed_enc.decrypt(b"password", false).unwrap();
println!("Decrypted seed bytes: {}", hex::encode(&seed.bytes[..]));
}
Re-generating header: cargo build --release --features generate-capi
To compile with additional language support you can use:
cargo build --release --features lang-spanish lang-french lang-czech