internal static StrengthIndicator StrengthChecker(string data) { if (_estimator == null) { _estimator = new ZxcvbnEstimator(); } var strengthIndicator = new StrengthIndicator(); if (string.IsNullOrEmpty(data)) { throw new Exception("Can't check strength for empty string."); } var result = _estimator.EstimateStrength(data); strengthIndicator.Guesses = Math.Log(result.Guesses) / Math.Log(10); if (strengthIndicator.Guesses < Constants.StrengthScoreVeryWeak) { strengthIndicator.Strength = Constants.StrengthVeryWeak; } else if (strengthIndicator.Guesses < Constants.StrengthScoreWeak) { strengthIndicator.Strength = Constants.StrengthWeak; } else if (strengthIndicator.Guesses < Constants.StrengthScoreSomeWhatSecure) { strengthIndicator.Strength = Constants.StrengthSomewhatSecure; } else if (strengthIndicator.Guesses >= Constants.StrengthScoreSomeWhatSecure) { strengthIndicator.Strength = Constants.StrengthSecure; } strengthIndicator.Percentage = Math.Round(Math.Min((strengthIndicator.Guesses / 16) * 100, 100)); return(strengthIndicator); }
// Use this for initialization void Start() { audioCollect = GameObject.Find ("SFX"); Time.timeScale = 0; lastShipPos= transform.position; shipAnim = GetComponent<Animator> (); shipRB = GetComponent<Rigidbody2D> (); instructions = true; playGame = false; tiltAngles = Input.acceleration.x; StrengthScript = theStrength.GetComponent<StrengthIndicator> (); StrengthScriptShadow = theStrengthShadow.GetComponent<StrengthIndicator> (); }