go.crypto/blowfish: allow shorter passwords.
bcrypt didn't allow one, two and three letter passwords which is a policy decision best left to the user of the code. Some users have legacy issues which require such short passwords to be processed. LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/81800044
This commit is contained in:
@@ -53,6 +53,15 @@ func TestBcryptingIsCorrect(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestVeryShortPasswords(t *testing.T) {
|
||||
key := []byte("k")
|
||||
salt := []byte("XajjQvNhvvRt5GSeFk1xFe")
|
||||
_, err := bcrypt(key, 10, salt)
|
||||
if err != nil {
|
||||
t.Errorf("One byte key resulted in error: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestTooLongPasswordsWork(t *testing.T) {
|
||||
salt := []byte("XajjQvNhvvRt5GSeFk1xFe")
|
||||
// One byte over the usual 56 byte limit that blowfish has
|
||||
|
||||
Reference in New Issue
Block a user