Пример #1
0
        /// <summary>
        /// Takes in the words of a mnemonic sentence and it rebuilds the word index, having the valid index allows us to hot swap between languages/word lists :)
        /// </summary>
        /// <param name="wordsInMnemonicSentence"> a string array containing each word in the mnemonic sentence</param>
        /// <returns>The word index that can be used to build the mnemonic sentence</returns>
        private List <int> RebuildWordIndexes(string[] wordsInMnemonicSentence)
        {
            List <int> wordIndexList = new List <int>();
            string     langName      = "English";

            Wordlists.Wordlist wordlist = new Wordlists.English();

            foreach (string s in wordsInMnemonicSentence)
            {
                int idx = -1;

                if (!wordlist.WordExists(s, out idx))
                {
                    throw new Exception("Word " + s + " is not in the wordlist for language " + langName + " cannot continue to rebuild entropy from wordlist");
                }

                wordIndexList.Add(idx);
            }

            return(wordIndexList);
        }