pub fn mnemonic_to_seed<S1, S2>(&self, mnemonic: S1, passphrase: S2) -> String
    where
        S1: Into<String>,
        S2: Into<String>,
    {
        let mnemonic = mnemonic.into();
        let passphrase = passphrase.into();
        // To create a binary seed from the mnemonic,
        // we use the PBKDF2 function with a mnemonic sentence used as the password
        let password = mnemonic.as_str().nfkd().collect::<String>();
        let slat = format!("{}{}", MNEMONIC, passphrase)
            .nfkd()
            .collect::<String>();

        // The length of the derived key is 512 bits (= 64 bytes).
        let mut hash_password = [0u8; 64];

        // The iteration count is set to 2048
        pbkdf2::<HmacSha512>(
            password.as_bytes(),
            slat.as_bytes(),
            2048,
            &mut hash_password,
        );

        hex::encode(hash_password)
    }
/*
    A user may decide to protect their mnemonic with a passphrase.
    If a passphrase is not present, an empty string "" is used instead.
    */
A user may decide to protect their mnemonic with a passphrase.
If a passphrase is not present, an empty string "" is used instead.
A user may decide to protect their mnemonic with a passphrase . If a passphrase is not present an empty string " " is used instead .
pub fn mnemonic_to_seed<S1, S2>(&self, mnemonic: S1, passphrase: S2) -> String
    where
        S1: Into<String>,
        S2: Into<String>,
    {
        let mnemonic = mnemonic.into();
        let passphrase = passphrase.into();
        // To create a binary seed from the mnemonic,
        // we use the PBKDF2 function with a mnemonic sentence used as the password
        let password = mnemonic.as_str().nfkd().collect::<String>();
        let slat = format!("{}{}", MNEMONIC, passphrase)
            .nfkd()
            .collect::<String>();
        // The length of the derived key is 512 bits (= 64 bytes).
        let mut hash_password = [0u8; 64];
        // The iteration count is set to 2048
        pbkdf2::<HmacSha512>(
            password.as_bytes(),
            slat.as_bytes(),
            2048,
            &mut hash_password,
        );
        hex::encode(hash_password)
    }
pub fn mnemonic_to_seed < S1 , S2 > ( & self , mnemonic : S1 , passphrase : S2 ) -> String where S1 : Into < String > , S2 : Into < String > , { let mnemonic = mnemonic . into ( ) ; let passphrase = passphrase . into ( ) ; // To create a binary seed from the mnemonic, // we use the PBKDF2 function with a mnemonic sentence used as the password let password = mnemonic . as_str ( ) . nfkd ( ) . collect :: < String > ( ) ; let slat = format ! ( " " MNEMONIC passphrase ) . nfkd ( ) . collect :: < String > ( ) ; // The length of the derived key is 512 bits (= 64 bytes). let mut hash_password = [ 0u8 ; 64 ] ; // The iteration count is set to 2048 pbkdf2 :: < HmacSha512 > ( password . as_bytes ( ) , slat . as_bytes ( ) , 2048 , & mut hash_password , ) ; hex :: encode ( hash_password ) }
A user may decide to protect their mnemonic with a passphrase.
A user may decide to protect their mnemonic with a passphrase .
&self
mnemonic
S1
passphrase
S2