package org.springblade.common.utils;

import java.security.SecureRandom;
import java.util.Base64;

/**
 * @className:GenerateUtil
 * @author:cwchen
 * @date:2025-09-04-14:22
 * @version:1.0
 * @description:生成密钥等工具类
 */
public class GenerateUtil {

    public static String generateRandomSecret(int length) {
        SecureRandom random = new SecureRandom();
        byte[] bytes = new byte[length];
        random.nextBytes(bytes);
        return Base64.getEncoder().encodeToString(bytes);
    }

    public static void main(String[] args) {
        System.err.println(generateRandomSecret(32));;
    }
}
