コード例 #1
0
ファイル: Extensions.cs プロジェクト: junderw/NBXplorer
        internal static uint160 GetHash(this TrackedSource trackedSource)
        {
            if (trackedSource is DerivationSchemeTrackedSource t)
            {
                return(t.DerivationStrategy.GetHash());
            }
            var data = Encoding.UTF8.GetBytes(trackedSource.ToString());

            return(new uint160(Hashes.RIPEMD160(data, data.Length)));
        }
コード例 #2
0
ファイル: Extensions.cs プロジェクト: quangtrung89/NBXplorer
 internal static string ToPrettyString(this TrackedSource trackedSource)
 {
     if (trackedSource is DerivationSchemeTrackedSource derivation)
     {
         var strategy = derivation.DerivationStrategy.ToString();
         if (strategy.Length > 35)
         {
             strategy = strategy.Substring(0, 10) + "..." + strategy.Substring(strategy.Length - 20);
         }
         return(strategy);
     }
     else if (trackedSource is AddressTrackedSource addressDerivation)
     {
         return(addressDerivation.Address.ToString());
     }
     else
     {
         return(trackedSource.ToString());
     }
 }