mnemonic_to_entropy

Function mnemonic_to_entropy 

Source
pub fn mnemonic_to_entropy(
    mnemonic_phrase: &str,
) -> Result<Vec<u8>, DerivationError>
Expand description

Converts a mnemonic phrase to entropy bytes.

§Arguments

  • mnemonic_phrase - The mnemonic phrase to convert

§Returns

  • Result<Vec<u8>, DerivationError> - The entropy bytes or an error

§Security

WARNING: The returned entropy is sensitive cryptographic material. Callers must ensure the returned Vec<u8> is properly zeroized when no longer needed. Consider using zeroize::Zeroize trait to securely clear the data from memory.

§Example

use bitcoin_address_generator::mnemonic_to_entropy;

let mnemonic = "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about";
let entropy = mnemonic_to_entropy(mnemonic).unwrap();
assert_eq!(entropy.len(), 16); // 128 bits for 12-word mnemonic