diff options
-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)) { |