Here you can find the source of SHA256(String text)
public static byte[] SHA256(String text)
//package com.java2s; //License from project: Mozilla Public License import java.io.UnsupportedEncodingException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Main { public static byte[] SHA256(String text) { try {/*from w ww . j a v a 2 s . c o m*/ MessageDigest md; md = MessageDigest.getInstance("SHA-256"); md.update(text.getBytes("UTF-8"), 0, text.length()); return md.digest(); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } } }