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)); }
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)); }