static void Main(string[] args)
 {
     //p1^p2^p3,p2^p3^p4,p1^p3^p4,p1^p2^p4,p4^p5^p6,p4^p5^p7,p4^p6^p7
     //P1^P2,P2^P3,P3^p4,p3^p5,p3^p6,p6^p7,p7^p8,p8^p1
     //P1^P2,P2^P3,P3^p4,p4^p5,p5^p6,p6^p7,p7^p8,p8^p1
     AccessStructure acc = new AccessStructure("P1^P2,P2^P3,P3^p4,p4^p5,p5^p6,p6^p7,p7^p8,p8^p1");
                var expanded = new List<QualifiedSubset>();
             var qualified = new List<QualifiedSubset>();
             var thresholds = new List<ThresholdSubset>();
             var remaining = new List<QualifiedSubset>();
             var attempts = new List<String>();
             var tryIntersect = true;
             ThresholdHelper.ServeThresholdDetection(acc, tryIntersect, out expanded, out  qualified, out  thresholds, out attempts, out remaining);
             //foreach (var att in attempts)
             //{
             //    Console.WriteLine(att);
             //}
             Console.WriteLine("all threshold attempts:{0}",attempts.Count);
             Console.WriteLine("all fixed threshold attempts:{0}", ThresholdSubset.fixedAttemptTrace.Count);
             Console.WriteLine("all found thresholds:");
             foreach (var thre in thresholds)
             {
                 Console.WriteLine(thre);
             }
             Console.WriteLine("all unique thresholds:");
             foreach (var thre in ThresholdSubset.CheckInclusiveThresholds(thresholds))
             {
                 Console.WriteLine(thre);
             }
     Console.Read();
     return;
 }
        public static bool IsQualifiedSubset(QualifiedSubset subsetToTest, AccessStructure miniamlAccess)
        {
            foreach (var qualifiedSet in miniamlAccess.Accesses)
               {
               if (!(qualifiedSet is QualifiedSubset)) continue;
               HashSet<int> a = new HashSet<int>(subsetToTest.Parties.Select(x => x.GetPartyId()));
               var qs = (QualifiedSubset)qualifiedSet;
               HashSet<int> b = new HashSet<int>(qs.Parties.Select(x => x.GetPartyId()));

               if (b.IsProperSubsetOf(a) || b.IsSubsetOf(a)) return true;
               }
               return false;
        }
Beispiel #3
0
        public static bool IsQualifiedSubset(QualifiedSubset subsetToTest, AccessStructure miniamlAccess)
        {
            foreach (var qualifiedSet in miniamlAccess.Accesses)
            {
                if (!(qualifiedSet is QualifiedSubset))
                {
                    continue;
                }
                HashSet <int> a  = new HashSet <int>(subsetToTest.Parties.Select(x => x.GetPartyId()));
                var           qs = (QualifiedSubset)qualifiedSet;
                HashSet <int> b  = new HashSet <int>(qs.Parties.Select(x => x.GetPartyId()));

                if (b.IsProperSubsetOf(a) || b.IsSubsetOf(a))
                {
                    return(true);
                }
            }
            return(false);
        }