1.准备工作
所需jar包:
bcprov-jdk15on-1.59.jar
commons-lang3-3.1.jar
对应的maven依赖
org.bouncycastle
bcprov-jdk15on
1.66
import org.bouncycastle.crypto.digests.SM3Digest;
import org.bouncycastle.crypto.macs.HMac;
import org.bouncycastle.crypto.params.KeyParameter;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.bouncycastle.pqc.math.linearalgebra.ByteUtils;
import java.io.UnsupportedEncodingException;
import java.security.Security;
import java.util.Arrays;
/**
* sm3加密算法工具类
* @explain 加密与加密结果验证(不可逆算法)
* @author Marydon
* @creationTime 2018年7月5日上午10:01:24
* @version 1.0
* @since
* @email marydon20170307@163.com
*/
public class Sm3Utils {
private static final String ENCODI