@Test public void testVariousPwLengthShouldBeDifferentHashes() { Bytes pw = Bytes.random(256); byte[] salt = Bytes.random(16).array(); Set<String> hashes = new HashSet<>(); for (int i = 0; i < 72; i++) { BCrypt.HashData data = BCrypt.with(LongPasswordStrategies.truncate(DEFAULT_VERSION)).hashRaw(4, salt, pw.resize(i, BytesTransformer.ResizeTransformer.Mode.RESIZE_KEEP_FROM_ZERO_INDEX).array()); String hashHexString = Bytes.wrap(data.rawHash).encodeHex(); assertFalse("hash already in set for length " + i, hashes.contains(hashHexString)); hashes.add(hashHexString); } }
public static Hasher with(Version version) { return new Hasher(version, new SecureRandom(), LongPasswordStrategies.strict(version)); }
BCrypt { public static Hasher with(Version version) { return new Hasher(version, new SecureRandom(), LongPasswordStrategies.strict(version)); } }
BCrypt { public static Hasher with(Version version) { return new Hasher(version, new SecureRandom(), LongPasswordStrategies.strict(version)); } private  BCrypt(); }
BCrypt { public static Hasher with(Version version) { return new Hasher(version, new SecureRandom(), LongPasswordStrategies.strict(version)); } private  BCrypt(); static Hasher withDefaults(); static Hasher with(Version version); static Hasher with(SecureRandom secureRandom); static Hasher with(LongPasswordStrategy longPasswordStrategy); static Hasher with(Version version, LongPasswordStrategy longPasswordStrategy); static Hasher with(Version version, SecureRandom secureRandom, LongPasswordStrategy longPasswordStrategy); static Verifyer verifyer(); static Verifyer verifyer(Version version); static Verifyer verifyer(Version version, LongPasswordStrategy longPasswordStrategy); }
BCrypt { public static Hasher with(Version version) { return new Hasher(version, new SecureRandom(), LongPasswordStrategies.strict(version)); } private  BCrypt(); static Hasher withDefaults(); static Hasher with(Version version); static Hasher with(SecureRandom secureRandom); static Hasher with(LongPasswordStrategy longPasswordStrategy); static Hasher with(Version version, LongPasswordStrategy longPasswordStrategy); static Hasher with(Version version, SecureRandom secureRandom, LongPasswordStrategy longPasswordStrategy); static Verifyer verifyer(); static Verifyer verifyer(Version version); static Verifyer verifyer(Version version, LongPasswordStrategy longPasswordStrategy); static final int SALT_LENGTH; static final int MIN_COST; static final int MAX_COST; }