Esempio n. 1
0
        //public float GetScoreForCondition(Condition c)
        //{

        //    double score =
        //        c.alpha*
        //        ( (
        //            AccountFailuresInfrequentPassword*c.phi_infrequent +
        //            AccountFailuresFrequentPassword*c.phi_frequent
        //            ) +
        //            c.repeat *
        //           (
        //            RepeatAccountFailuresInfrequentPassword*c.phi_infrequent +
        //            RepeatAccountFailuresFrequentPassword*c.phi_frequent
        //           )
        //        )
        //        +
        //        c.beta_notypo * c.phi_infrequent * (
        //            PasswordFailuresNoTypoInfrequentPassword +
        //            RepeatPasswordFailuresNoTypoInfrequentPassword * c.repeat)
        //        +
        //        c.beta_notypo * c.phi_frequent * (
        //            PasswordFailuresNoTypoFrequentPassword +
        //            RepeatPasswordFailuresNoTypoFrequentPassword * c.repeat)
        //        +
        //        c.beta_typo * c.phi_infrequent * (
        //            PasswordFailuresTypoInfrequentPassword +
        //            RepeatPasswordFailuresTypoInfrequentPassword * c.repeat)
        //        +
        //        c.beta_typo * c.phi_frequent * (
        //            PasswordFailuresTypoFrequentPassword +
        //            RepeatPasswordFailuresTypoFrequentPassword * c.repeat)
        //        ;
        //  score -= c.gamma*SuccessfulLogins;
        //    if (!IsFrequentlyGuessedPassword)
        //        score /= c.T;
        //    if (DeviceCookieHadPriorSuccessfulLoginForThisAccount)
        //        score = 0;

        //    return (float) score;
        //}

        public int CompareTo(Trial other, ICondition condition)
        {
            float myScore     = condition.GetScore(this);
            float othersScore = condition.GetScore(other);

            if (myScore < othersScore)
            {
                return(-1);
            }
            if (myScore > othersScore)
            {
                return(1);
            }
            return(0);
        }
Esempio n. 2
0
        //public float GetScoreForCondition(Condition c)
        //{

        //    double score =
        //        c.alpha*
        //        ( ( 
        //            AccountFailuresInfrequentPassword*c.phi_infrequent +
        //            AccountFailuresFrequentPassword*c.phi_frequent 
        //            ) +
        //            c.repeat * 
        //           (
        //            RepeatAccountFailuresInfrequentPassword*c.phi_infrequent + 
        //            RepeatAccountFailuresFrequentPassword*c.phi_frequent
        //           )
        //        )
        //        +
        //        c.beta_notypo * c.phi_infrequent * (
        //            PasswordFailuresNoTypoInfrequentPassword +
        //            RepeatPasswordFailuresNoTypoInfrequentPassword * c.repeat)
        //        +
        //        c.beta_notypo * c.phi_frequent * (
        //            PasswordFailuresNoTypoFrequentPassword +
        //            RepeatPasswordFailuresNoTypoFrequentPassword * c.repeat)
        //        +
        //        c.beta_typo * c.phi_infrequent * (
        //            PasswordFailuresTypoInfrequentPassword +
        //            RepeatPasswordFailuresTypoInfrequentPassword * c.repeat)
        //        +
        //        c.beta_typo * c.phi_frequent * (
        //            PasswordFailuresTypoFrequentPassword +
        //            RepeatPasswordFailuresTypoFrequentPassword * c.repeat)
        //        ;
        //  score -= c.gamma*SuccessfulLogins;
        //    if (!IsFrequentlyGuessedPassword)
        //        score /= c.T;
        //    if (DeviceCookieHadPriorSuccessfulLoginForThisAccount)
        //        score = 0;
            
        //    return (float) score;
        //}

        public int CompareTo(Trial other, ICondition condition)
        {
            float myScore = condition.GetScore(this);
            float othersScore = condition.GetScore(other);
            if (myScore < othersScore)
                return -1;
            if (myScore > othersScore)
                return 1;
            return 0;
        }