com.seeq.utilities.encryption.PasswordGenerator Maven / Gradle / Ivy
The newest version!
package com.seeq.utilities.encryption;
import java.security.SecureRandom;
import java.util.Base64;
public final class PasswordGenerator {
private static final SecureRandom SECURE_RANDOM = new SecureRandom();
private PasswordGenerator() {}
public static String generatePassword() {
byte[] randomBytes = new byte[16];
SECURE_RANDOM.nextBytes(randomBytes);
return Base64.getEncoder()
.withoutPadding()
.encodeToString(randomBytes);
}
}