package com.qmth.jkserver.util;

import com.qmth.jkserver.constant.SystemConstant;
import com.qmth.jkserver.signature.Constants;

import java.security.MessageDigest;

/**
 * @Description: sha util
 * @Param:
 * @return:
 * @Author: wangliang
 * @Date: 2020/12/16
 */
public class ShaUtils implements Constants {

    public static byte[] sha1(String input) {
        try {
            return MessageDigest.getInstance("SHA1").digest(input.getBytes(SystemConstant.CHARSET));
        } catch (Exception e) {
            return null;
        }
    }

    public static byte[] sha256(String input) {
        try {
            return MessageDigest.getInstance("SHA256").digest(input.getBytes(SystemConstant.CHARSET));
        } catch (Exception e) {
            return null;
        }
    }

}
