记AES加密在linux系统每次都不一样的问题
在项目中通常会用到AES的加密方法,具体代码如下
package com.mt.demo.client.utils;
import lombok.extern.slf4j.Slf4j;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.springframework.stereotype.Component;
import javax.crypto.*;
import javax.crypto.spec.SecretKeySpec;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.security.*;
import java.util.Base64;
/**
* AESUtils
*
* @author mt.luo
* @description: AES加密
*/
@Slf4j
@Component
public class AESUtils {
private final String aesSeed = "ada46ab5da824b96a18409c49dc91dc2";
private final String algorithm = "SHA-256";
private final String AES = "AES";
private final String cipher = "AES/ECB/PKCS7Padding";
private final String provider = "BC";
/**
* convert to byte[]
*
* @param key key
* @return byte[]
*