package cn.com.qmth.stmms.admin.utils;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

/**
 * SHA256加密
 * 
 * @author WANGWEI
 *
 */
public class SHA256 {

	public static byte[] encode(String str) {
		MessageDigest messageDigest;
		try {
			messageDigest = MessageDigest.getInstance("SHA-256");
		} catch (NoSuchAlgorithmException e) {
			throw new RuntimeException(e);
		}
		messageDigest.update(str.getBytes());
		return messageDigest.digest();
	}

}