class PasswordHash {

    public boolean matches(String secret)
    {
        byte[] candidate;
        try {
            candidate = digest(salt, algorithm, secret);
        } catch (NoSuchAlgorithmException e) {
            log.error(e.getMessage());
            return false;
        }
        return Arrays.equals(candidate, hash);
    }

    private  PasswordHash();
    public  PasswordHash(String algorithm, byte[] salt, byte[] hash);
    public  PasswordHash(String algorithm, String salt, String hash);
    public  PasswordHash(String password);

}