private void UpdatePasswordEntropy(string pw) { int entropyInBits = EntropyCalcs.CalcutePasswordEntropy(pw); PasswordSecurityLevel level = EntropyCalcs.GetPasswordSecurityLevel(entropyInBits); this.PasswordEntropy = $"{LocMan.Get("Password entropy:")} {entropyInBits} {LocMan.Get("bits")} ({level})"; OnPropertyChanged(nameof(PasswordEntropy)); }
public void GetPasswordSecurityLevelTest() { // Arrange string first = "cat"; string second = "cat!24TBTB1214b!DF¤"; // Act PasswordSecurityLevel securityLevelFirst = EntropyCalcs.GetPasswordSecurityLevel(EntropyCalcs.CalcutePasswordEntropy(first)); PasswordSecurityLevel securityLevelSecond = EntropyCalcs.GetPasswordSecurityLevel(EntropyCalcs.CalcutePasswordEntropy(second)); // Assert Assert.AreEqual(PasswordSecurityLevel.Very_Weak, securityLevelFirst); Assert.AreNotEqual(securityLevelFirst, securityLevelSecond); }