Esempio n. 1
0
        public void ElectrumSv_PubKey_Without_Custom_Words()
        {
            const string seed       = "police off kit fee village rather kind when turn crowd fun that";
            const string pub        = "xpub661MyMwAqRbcGAH5Lmmp6Tq7qtwnDfkJnMjz96AsLZTJZbHyGZe4CL792x3Eu1cNVt7BVXTAQWeQb2HBgrbcd3QZKc8M2UcX2tXy7RkLGXx";
            const string seedHash   = "df4ec2782c76449989f780483b57775fc6ac66c2c274abc27566b5427875529881faf0aac27aea4b294ea27e5213a44f28f8ef4fae66cd070e76bd6a6adeb08f";
            const int    iterations = 2048;

            var hash = Hashes.PbKdf2HmacSha512(seed.Utf8ToBytes(), $"electrum{(string) null}".Utf8ToBytes(), iterations);
            var key  = ExtPrivateKey.MasterBip32(hash.Span);

            Assert.Equal(seedHash, Encoders.Hex.Encode(hash));
            Assert.Equal(pub, key.GetExtPublicKey().ToString());
            Assert.Equal(key, KzElectrumSv.GetMasterPrivateKey(seed));
        }
Esempio n. 2
0
        public void electrumsv_PubKey_without_custom_words()
        {
            var seed        = "police off kit fee village rather kind when turn crowd fun that";
            var customWords = (string)null;
            var pub         = "xpub661MyMwAqRbcGAH5Lmmp6Tq7qtwnDfkJnMjz96AsLZTJZbHyGZe4CL792x3Eu1cNVt7BVXTAQWeQb2HBgrbcd3QZKc8M2UcX2tXy7RkLGXx";
            var seedHash    = "df4ec2782c76449989f780483b57775fc6ac66c2c274abc27566b5427875529881faf0aac27aea4b294ea27e5213a44f28f8ef4fae66cd070e76bd6a6adeb08f";
            var iterations  = 2048;

            var hash = KzHashes.pbkdf2_hmac_sha512(seed.UTF8ToBytes(), $"electrum{customWords}".UTF8ToBytes(), iterations);
            var key  = KzExtPrivKey.MasterBip32(hash.Span);

            Assert.Equal(seedHash, hash.ToHex());
            Assert.Equal(pub, key.GetExtPubKey().ToString());
            Assert.Equal(key, KzElectrumSv.GetMasterPrivKey(seed));
        }
Esempio n. 3
0
        public void electrumsv_PubKey_with_custom_words()
        {
            var seed        = "bachelor nominee surprise visa oak negative anxiety observe catch sibling act hawk";
            var customWords = "fred fruitbat";
            var pub         = "xpub661MyMwAqRbcH576xNa2EBv7NKLFqeGhwxqMVjLe7oKpQhdMEUjitTZzhEJRX2vAz8xn9x7V8vDhAJ87EoSgBoqNi5jCrdSrdwad6tb2trR";
            var seedHash    = "f53fcf294737ded129179824d437b9f393d00afddaabc58918e15cef9246bbdcbae20af66ae15420a66c2e7115b3066296dc3d9e893d3a41bff9fe47ca702f1d";
            var iterations  = 2048;

            var hash = KzHashes.pbkdf2_hmac_sha512(seed.UTF8ToBytes(), $"electrum{customWords}".UTF8ToBytes(), iterations);
            var key  = KzExtPrivKey.MasterBip32(hash.Span);

            Assert.Equal(seedHash, hash.ToHex());
            Assert.Equal(pub, key.GetExtPubKey().ToString());
            Assert.Equal(key, KzElectrumSv.GetMasterPrivKey(seed, customWords));
        }
Esempio n. 4
0
        public void ElectrumSv_PubKey_With_Custom_Words()
        {
            const string seed        = "bachelor nominee surprise visa oak negative anxiety observe catch sibling act hawk";
            const string customWords = "fred fruitbat";
            const string pub         = "xpub661MyMwAqRbcH576xNa2EBv7NKLFqeGhwxqMVjLe7oKpQhdMEUjitTZzhEJRX2vAz8xn9x7V8vDhAJ87EoSgBoqNi5jCrdSrdwad6tb2trR";
            const string seedHash    = "f53fcf294737ded129179824d437b9f393d00afddaabc58918e15cef9246bbdcbae20af66ae15420a66c2e7115b3066296dc3d9e893d3a41bff9fe47ca702f1d";
            const int    iterations  = 2048;

            var hash = Hashes.PbKdf2HmacSha512(seed.Utf8ToBytes(), $"electrum{customWords}".Utf8ToBytes(), iterations);
            var key  = ExtPrivateKey.MasterBip32(hash);

            Assert.Equal(seedHash, Encoders.Hex.Encode(hash));
            Assert.Equal(pub, key.GetExtPublicKey().ToString());
            Assert.Equal(key, KzElectrumSv.GetMasterPrivateKey(seed, customWords));
        }