Commit Graph

4 Commits

Author SHA1 Message Date
Luke Taylor
d27d464627 Fix cost parsing for bcrypt
The tens value was wrong for values of 20+, as reported in #230.
It should be 10*costTens not 10^costTens. This wasn't detected because
the values are the same when costTens is 1, and using high cost values
is rare with bcrypt because of the performance hit.

Also added a simple hash and validate test since the KAT tests only do
validation. This doesn't cover this bug since the cost value is too
high to include in the test. It allows similar issues to be tested
locally though.
2018-04-17 13:51:04 +01:00
Luke Taylor
fb66c35f46 Add a check for salt length in bcrypt function
Raises an error (as the original doc claimed) if the salt is not the
required length of 16 bytes.

validatePasswordEither doesn't require separate checking since the hash
length as a whole is checked, implicitly ensuring the salt is the right
length. Therefore it shouldn't be possible to trigger the error by
calling this function.

Fixes #93.
2016-07-27 17:45:33 +02:00
Vincent Hanquez
081a14326e [tests] remove duplicated symbol in BCrypt 2015-11-19 14:23:45 +00:00
Luke Taylor
a888501bb8 Add bcrypt tests
Mostly copied from openwall source, leaving out the unsupported 2x
tests and special bug-related tests for passwords containing 0xFF bytes.
2015-08-26 10:33:36 +01:00