Beispiel #1
0
 public void FailWhenMnemonicIsToShortTest()
 {
     Assert.Throws <Exception>(delegate
     {
         Mnemonic.SeedFromEntropy(Utils.HexToByteArray("7f7f7f7f7f"), "Substrate");
     });
 }
Beispiel #2
0
        public void MnemonicSeedAndMiniSecretTest()
        {
            foreach (var vector in Vectors)
            {
                var mnemonic         = vector[0];
                var expected_entropy = vector[1];
                var expected_seed    = vector[2];

                var entropy = Mnemonic.GetEntropy(mnemonic, BIP39Wordlist.English);
                Assert.AreEqual(expected_entropy, entropy);

                var seed            = Mnemonic.SeedFromEntropy(Utils.HexToByteArray(entropy), "Substrate");
                var seedAsHexString = Utils.Bytes2HexString(seed, Utils.HexStringFormat.Pure);
                Assert.AreEqual(expected_seed, seedAsHexString.ToLower());

                var miniSecret = Mnemonic.GetSecretKeyFromMnemonic(mnemonic, "Substrate", BIP39Wordlist.English);
                Assert.AreEqual(expected_seed.Substring(0, 64), Utils.Bytes2HexString(miniSecret, Utils.HexStringFormat.Pure).ToLower());
            }
        }