Пример #1
0
 public bool Equals(CfdKeyData other)
 {
     if (KeyType != other.KeyType)
     {
         return(false);
     }
     else if (KeyType == CfdDescriptorKeyType.Bip32)
     {
         return(ExtPubkey.Equals(other.ExtPubkey));
     }
     else if (KeyType == CfdDescriptorKeyType.Bip32Priv)
     {
         return(ExtPrivkey.Equals(other.ExtPrivkey));
     }
     else if (KeyType == CfdDescriptorKeyType.Public)
     {
         return(Pubkey.Equals(other.Pubkey));
     }
     else if (KeyType == CfdDescriptorKeyType.SchnorrPubkey)
     {
         return(SchnorrPubkey.Equals(other.SchnorrPubkey));
     }
     else
     {
         return(false);
     }
 }
Пример #2
0
 public CfdKeyData(ExtPrivkey extPrivkey)
 {
     KeyType    = CfdDescriptorKeyType.Bip32Priv;
     Pubkey     = new Pubkey();
     ExtPubkey  = new ExtPubkey();
     ExtPrivkey = extPrivkey;
 }
Пример #3
0
 public CfdKeyData(Pubkey pubkey)
 {
     KeyType    = CfdDescriptorKeyType.Public;
     Pubkey     = pubkey;
     ExtPubkey  = new ExtPubkey();
     ExtPrivkey = new ExtPrivkey();
 }
Пример #4
0
 public CfdKeyData(SchnorrPubkey schnorrPubkey)
 {
     KeyType       = CfdDescriptorKeyType.SchnorrPubkey;
     Pubkey        = new Pubkey();
     ExtPubkey     = new ExtPubkey();
     ExtPrivkey    = new ExtPrivkey();
     SchnorrPubkey = schnorrPubkey;
 }
Пример #5
0
 public CfdKeyData(ExtPubkey extPubkey)
 {
     KeyType       = CfdDescriptorKeyType.Bip32;
     Pubkey        = new Pubkey();
     ExtPubkey     = extPubkey;
     ExtPrivkey    = new ExtPrivkey();
     SchnorrPubkey = new SchnorrPubkey();
 }
Пример #6
0
 public CfdKeyData(CfdDescriptorKeyType keyType, Pubkey pubkey,
                   ExtPubkey extPubkey, ExtPrivkey extPrivkey)
 {
     KeyType    = keyType;
     Pubkey     = pubkey;
     ExtPubkey  = extPubkey;
     ExtPrivkey = extPrivkey;
 }
Пример #7
0
 public override int GetHashCode()
 {
     if (KeyType == CfdDescriptorKeyType.Bip32)
     {
         return(KeyType.GetHashCode() + ExtPubkey.GetHashCode());
     }
     else if (KeyType == CfdDescriptorKeyType.Bip32Priv)
     {
         return(KeyType.GetHashCode() + ExtPrivkey.GetHashCode());
     }
     else if (KeyType == CfdDescriptorKeyType.Public)
     {
         return(KeyType.GetHashCode() + Pubkey.GetHashCode());
     }
     else if (KeyType == CfdDescriptorKeyType.SchnorrPubkey)
     {
         return(KeyType.GetHashCode() + SchnorrPubkey.GetHashCode());
     }
     else
     {
         return(KeyType.GetHashCode());
     }
 }