Here you can find the source of SHA256(String input)
public static String SHA256(String input)
//package com.java2s; //License from project: Apache License import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Main { public final static String ALGORITHM_SHA256 = "SHA-256"; public static String SHA256(String input) { return toHexString(SHA256byte(input)); }// w w w.j a v a2s . co m private static String toHexString(byte[] data) { StringBuilder sb = new StringBuilder(); for (byte b : data) { String hex = Integer.toHexString(0xff & b); if (hex.length() == 1) sb.append('0'); sb.append(hex); } return sb.toString(); } private static byte[] SHA256byte(String input) { try { MessageDigest md = MessageDigest.getInstance(ALGORITHM_SHA256); return md.digest(input.getBytes()); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } } }