All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.nulabinc.zxcvbn.guesses.DateGuess Maven / Gradle / Ivy

Go to download

This is a java port of zxcvbn, which is a JavaScript password strength generator.

There is a newer version: 1.9.0
Show newest version
package com.nulabinc.zxcvbn.guesses;

import com.nulabinc.zxcvbn.Context;
import com.nulabinc.zxcvbn.matchers.Match;

public class DateGuess extends BaseGuess {

    public DateGuess(final Context context) {
        super(context);
    }

    @Override
    public double exec(Match match) {
        double yearSpace = Math.max(Math.abs(match.year - REFERENCE_YEAR), MIN_YEAR_SPACE);
        double guesses = yearSpace * 365;
        if (match.separator != null && !match.separator.isEmpty()) guesses *= 4;
        return guesses;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy