package com.ruoyi;

import org.jasypt.encryption.pbe.PooledPBEStringEncryptor;
import org.jasypt.encryption.pbe.config.SimpleStringPBEConfig;

public class EncFactory {
    public static void main(String[] args) {
        String securityKey = "BUSINESS"; // 加密秘钥
        String data = "123456"; // 需要加密的字符串

        PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor();
        SimpleStringPBEConfig config = new SimpleStringPBEConfig();
        config.setPassword(securityKey);
        config.setAlgorithm("PBEWithMD5AndDES");
        config.setPoolSize("1");
        config.setStringOutputType("base64");
        encryptor.setConfig(config);

        System.out.println("ENC("+ encryptor.encrypt(data) +")");
        System.out.println(encryptor.decrypt("t3TY7+QFjQNRv8N833J1PRV6+/QTBwJP"));

    }
}
