package com.qmth.teachcloud.common.util;

import com.qmth.teachcloud.common.contant.SystemConstant;

import java.security.MessageDigest;

public class ShaUtils {

    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;
        }
    }

}
