public Mnemonic(string mnemonic, Wordlist wordlist = null) { if (mnemonic == null) { throw new ArgumentNullException("mnemonic"); } this._Mnemonic = mnemonic.Trim(); if (wordlist == null) { wordlist = Wordlist.AutoDetect(mnemonic) ?? Wordlist.English; } string[] words = mnemonic.Split((char[])null, StringSplitOptions.RemoveEmptyEntries); this._Mnemonic = string.Join(wordlist.Space.ToString(), words); //if the sentence is not at least 12 characters or cleanly divisible by 3, it is bad! if (!CorrectWordCount(words.Length)) { throw new FormatException("Word count should be equals to 12,15,18,21 or 24"); } this._Words = words; this._WordList = wordlist; this._Indices = wordlist.ToIndices(words); }
public Mnemonic(string mnemonic, Wordlist wordlist = null) { if (mnemonic == null) { throw new ArgumentNullException(nameof(mnemonic)); } _Mnemonic = mnemonic.Trim(); if (wordlist == null) { wordlist = Wordlist.AutoDetect(mnemonic) ?? Wordlist.English; } var words = mnemonic.Split(new char[] { ' ', ' ' }, StringSplitOptions.RemoveEmptyEntries); //if the sentence is not at least 12 characters or cleanly divisible by 3, it is bad! if (!CorrectWordCount(words.Length)) { throw new FormatException("Word count should be 12,15,18,21 or 24"); } _Words = words; _WordList = wordlist; _Indices = wordlist.ToIndices(words); }