Java tutorial
//package com.java2s; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Main { private static final char hexDigits[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; public static String encryptSHA224ToString(String data) { return encryptSHA224ToString(data.getBytes()); } public static String encryptSHA224ToString(byte[] data) { return bytes2HexString(encryptSHA224(data)); } private static String bytes2HexString(byte[] bytes) { if (bytes == null) return null; int len = bytes.length; if (len <= 0) return null; char[] ret = new char[len << 1]; for (int i = 0, j = 0; i < len; i++) { ret[j++] = hexDigits[bytes[i] >>> 4 & 0x0f]; ret[j++] = hexDigits[bytes[i] & 0x0f]; } return new String(ret); } public static byte[] encryptSHA224(byte[] data) { return hashTemplate(data, "SHA224"); } private static byte[] hashTemplate(byte[] data, String algorithm) { if (data == null || data.length <= 0) return null; try { MessageDigest md = MessageDigest.getInstance(algorithm); md.update(data); return md.digest(); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); return null; } } }