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

io.polyglotted.common.util.TokenUtil Maven / Gradle / Ivy

package io.polyglotted.common.util;

import java.math.BigInteger;
import java.security.SecureRandom;

@SuppressWarnings({"unused", "WeakerAccess"})
public abstract class TokenUtil {
    private static final SecureRandom random = new SecureRandom();

    public static String uniqueToken() { return uniqueToken(130); }

    public static String uniqueToken(int maxBits) { return new BigInteger(maxBits, random).toString(32).toLowerCase(); }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy