/// <summary> /// Computes 512 bit Bip39 seed. /// passphrase, password, and passwordPrefix are converted to bytes using UTF8 KD normal form encoding. /// </summary> /// <param name="passphrase">arbitrary passphrase (typically mnemonic words with checksum but not necessarily)</param> /// <param name="password">password and passwordPrefix are combined to generate salt bytes.</param> /// <param name="passwordPrefix">password and passwordPrefix are combined to generate salt bytes. Default is "mnemonic".</param> /// <returns>Computes 512 bit Bip39 seed.</returns> public static KzUInt512 Bip39Seed(string passphrase, string password = null, string passwordPrefix = "mnemonic") { return(KzHashes.pbkdf2_hmac_sha512(passphrase.UTF8NFKDToBytes(), $"{passwordPrefix}{password}".UTF8NFKDToBytes(), 2048)); }
public static KzExtPrivKey GetMasterPrivKey(string seed, string seedExtension = null) => KzExtPrivKey.Master(KzHashes.pbkdf2_hmac_sha512(seed.UTF8ToBytes(), $"electrum{seedExtension}".UTF8ToBytes(), 2048).Span);