From 5e2ed0394770a5f1d11c90fe19714dc4e30c3d64 Mon Sep 17 00:00:00 2001 From: redwrasse Date: Wed, 28 Aug 2024 16:54:57 -0700 Subject: [PATCH 1/2] bcrypt: update InvalidCostError message to describe cost range inclusive Signed-off-by: redwrasse --- bcrypt/bcrypt.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bcrypt/bcrypt.go b/bcrypt/bcrypt.go index dc9311870a..c99d3efedc 100644 --- a/bcrypt/bcrypt.go +++ b/bcrypt/bcrypt.go @@ -50,7 +50,7 @@ func (ih InvalidHashPrefixError) Error() string { type InvalidCostError int func (ic InvalidCostError) Error() string { - return fmt.Sprintf("crypto/bcrypt: cost %d is outside allowed range (%d,%d)", int(ic), MinCost, MaxCost) + return fmt.Sprintf("crypto/bcrypt: cost %d is outside allowed range [%d,%d]", int(ic), MinCost, MaxCost) } const ( From b49002b6b2cff0939858553a28e3f255bde397b6 Mon Sep 17 00:00:00 2001 From: redwrasse Date: Thu, 13 Mar 2025 15:19:47 -0700 Subject: [PATCH 2/2] bcrypt: explicitly state inclusive cost bounds in InvalidCostError string Signed-off-by: redwrasse --- bcrypt/bcrypt.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bcrypt/bcrypt.go b/bcrypt/bcrypt.go index c99d3efedc..3e7f8df871 100644 --- a/bcrypt/bcrypt.go +++ b/bcrypt/bcrypt.go @@ -50,7 +50,7 @@ func (ih InvalidHashPrefixError) Error() string { type InvalidCostError int func (ic InvalidCostError) Error() string { - return fmt.Sprintf("crypto/bcrypt: cost %d is outside allowed range [%d,%d]", int(ic), MinCost, MaxCost) + return fmt.Sprintf("crypto/bcrypt: cost %d is outside allowed inclusive range %d..%d", int(ic), MinCost, MaxCost) } const (