Example #1
0
        public void DeriveEntropyBip39_ExceptionTest()
        {
            var bip85 = new BIP0085(Xprv);
            var wl    = (BIP0039.WordLists) 1000;

            Exception ex = Assert.Throws <ArgumentException>(() => bip85.DeriveEntropyBip39(wl, 12, 0));

            Assert.Contains("Word-list is not defined.", ex.Message);

            ex = Assert.Throws <ArgumentException>(() => bip85.DeriveEntropyBip39(BIP0039.WordLists.English, 0, 0));
            Assert.Contains("Invalid seed length", ex.Message);

            bip85.Dispose();
            Assert.Throws <ObjectDisposedException>(() => bip85.DeriveEntropyBip39(BIP0039.WordLists.English, 12, 0));
        }
Example #2
0
        public void DeriveEntropyBip39Test(string xprv, BIP0039.WordLists lang, int wordLen, uint index, byte[] expectedEnt, string expectedMn)
        {
            using BIP0085 bip85 = new BIP0085(xprv);
            byte[] actualEnt = bip85.DeriveEntropyBip39(lang, wordLen, index);

            using BIP0039 bip39 = new BIP0039(actualEnt, lang);
            string actualMn = bip39.ToMnemonic();

            Assert.Equal(expectedEnt, actualEnt);
            Assert.Equal(expectedMn, actualMn);
        }