package com.bonus.common.core.utils.encryption;

import cn.hutool.crypto.SmUtil;
import cn.hutool.crypto.digest.SM3;
import java.io.File;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;


/**
 * @author weiweiw
 * SM3加解密
 */
public class Sm3Util {

    static SM3 sm3 = SmUtil.sm3WithSalt("2cc0c5f9f1749f1632efa9f63e902323".getBytes(StandardCharsets.UTF_8));


    public static String encrypt(String data) {
        return Sm3Util.sm3.digestHex(data);
    }

    public static String encrypt(InputStream data) {
        return Sm3Util.sm3.digestHex(data);
    }

    public static String encrypt(File dataFile) {
        return Sm3Util.sm3.digestHex(dataFile);
    }
}