From 40744337b5b7eb65df8e7fafbe6c97ee84660570 Mon Sep 17 00:00:00 2001 From: Tres Seaver <tseaver@palladion.com> Date: Tue, 15 Mar 2011 16:07:12 +0100 Subject: [PATCH] Avoid yet one more short-circuit. --- repoze/who/plugins/htpasswd.py | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-) diff --git a/repoze/who/plugins/htpasswd.py b/repoze/who/plugins/htpasswd.py index 7dfdfdb..0b72ccf 100644 --- a/repoze/who/plugins/htpasswd.py +++ b/repoze/who/plugins/htpasswd.py @@ -79,10 +79,9 @@ def _same_string(x, y): # Attempt at isochronous string comparison. - match = True - for a, b, ignored in itertools.izip_longest(x, y, PADDING): - match = a == b and match - return match + mismatches = sum([a != b for a, b, ignored + in itertools.izip_longest(x, y, PADDING)]) + return mismatches == 0 def crypt_check(password, hashed): from crypt import crypt -- Gitblit v1.9.3