From 72a9472e0ee32e369be2f3830e6248b2084f465f Mon Sep 17 00:00:00 2001 From: Orien Madgwick Date: Thu, 28 May 2026 12:20:24 +1000 Subject: [PATCH] Return `guesses` as Float for empty password Non-empty passwords return Float through the DP scoring path. Empty password short-circuits with an Integer 1, producing a type inconsistency. --- lib/zxcvbn/scorer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/zxcvbn/scorer.rb b/lib/zxcvbn/scorer.rb index 49d6810..5593e72 100644 --- a/lib/zxcvbn/scorer.rb +++ b/lib/zxcvbn/scorer.rb @@ -59,7 +59,7 @@ def initialize(data, omnimatch, reference_year) def most_guessable_match_sequence(password, matches, exclude_additive: false) n = password.length - return build_score(password, [], 1) if n.zero? + return build_score(password, [], 1.0) if n.zero? # index matches by their last character matches_by_j = Array.new(n) { [] }