diff options
author | lloyd <[email protected]> | 2011-06-20 18:05:53 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2011-06-20 18:05:53 +0000 |
commit | d03430f5aa465a518225791c32580f62ee687e8b (patch) | |
tree | f65a3c5bbaa8e865fa9815767ae05456a7f88e99 | |
parent | 3d2adee8a113929cd36cb00bc7759cf0fd29ca7e (diff) |
Add a second test for bcrypt, using an 8-bit character. This test
exposed a bug in JtR's blowfish code:
http://www.openwall.com/lists/john-dev/2011/06/19/2
-rw-r--r-- | checks/validate.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/checks/validate.cpp b/checks/validate.cpp index d79f9783a..65317604e 100644 --- a/checks/validate.cpp +++ b/checks/validate.cpp @@ -183,19 +183,23 @@ bool test_bcrypt(RandomNumberGenerator& rng) #if defined(BOTAN_HAS_BCRYPT) std::cout << "Testing Bcrypt: " << std::flush; - const std::string input = "abc"; + bool ok = true; // Generated by jBCrypt 0.3 - const std::string fixed_hash = - "$2a$05$DfPyLs.G6.To9fXEFgUL1O6HpYw3jIXgPcl/L3Qt3jESuWmhxtmpS"; + if(!check_bcrypt("abc", + "$2a$05$DfPyLs.G6.To9fXEFgUL1O6HpYw3jIXgPcl/L3Qt3jESuWmhxtmpS")) + { + std::cout << "Fixed bcrypt test failed\n"; + ok = false; + } std::cout << "." << std::flush; - bool ok = true; - - if(!check_bcrypt(input, fixed_hash)) + // http://www.openwall.com/lists/john-dev/2011/06/19/2 + if(!check_bcrypt("\xA3", + "$2a$05$/OK.fbVrR/bpIqNJ5ianF.Sa7shbm4.OzKpvFnX1pQLmQW96oUlCq")) { - std::cout << "Fixed bcrypt test failed\n"; + std::cout << "Fixed bcrypt test 2 failed\n"; ok = false; } @@ -203,7 +207,8 @@ bool test_bcrypt(RandomNumberGenerator& rng) for(u16bit level = 1; level != 5; ++level) { - std::string gen_hash = generate_bcrypt(input, rng, level); + const std::string input = "some test passphrase 123"; + const std::string gen_hash = generate_bcrypt(input, rng, level); if(!check_bcrypt(input, gen_hash)) { |