def onMasterPasswordChar(self, event): """Recalculate entropy any time the password changes.""" pwd = self.txtMasterPassword.GetValue() e = int(cryptor.entropy(pwd)) if e < 0: e = 0 if e > 100: e = 100 self.strength.SetValue(e) if event: event.Skip()
def testEntropy(self): passlist = ["a", "hello", "hellob", "(*&^KJHGjkhgrtoiua123"] for i in xrange(len(passlist)-1): self.assertTrue(entropy(passlist[i]) < entropy(passlist[i+1]))