コード例 #1
0
        public void Constructors()
        {
            var words = "afirmar diseño hielo fideo etapa ogro cambio fideo toalla pomelo número buscar";
            var m1    = new Mnemonic(words);

            Assert.Equal(Languages.Spanish, m1.Language);
            Assert.Equal(m1.Words, Mnemonic.FromWords(words).Words);

            var m2 = new Mnemonic(m1.Entropy, m1.Language);

            Assert.Equal(m1.Words, m2.Words);
            Assert.Equal(m2.Words, Mnemonic.FromEntropy(m1.Entropy, m1.Language).Words);

            var m3 = new Mnemonic(new byte[] { 5, 40, 161, 175, 172, 69, 19, 67, 74, 26, 196, 233, 87, 10, 119, 18 }, Languages.Spanish);

            Assert.Equal(m1.Words, m3.Words);

            var m4 = new Mnemonic(bitLength: 256);

            Assert.Equal(24, m4.Words.Split(' ').Length);
            Assert.Equal(24, Mnemonic.FromLength(256).Words.Split(' ').Length);
        }