Skip to main content

dice_mnemonic

Function dice_mnemonic 

Source
pub fn dice_mnemonic<const FACES: u8, const W: u8>(
    rolls: &[u8],
) -> Result<DiceMnemonic<FACES, W>, MnemonicError>
Expand description

Dice rolls to BIP39 mnemonic. FACES is the die size and W the word count; the matching words-<W> Cargo feature must be enabled.

Requires the dice and words-<W> features.

ยงExample

use kdk_mnemonic::{dice_mnemonic, DiceMnemonic};

let rolls = [1u8; 50];
let _: DiceMnemonic<6, 12> = dice_mnemonic::<6, 12>(&rolls).unwrap();