Java tutorial
//package com.java2s; import java.io.UnsupportedEncodingException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Main { public static byte[] dataDigest(String in) { byte[] sum = null; try { MessageDigest md = MessageDigest.getInstance("SHA-1"); byte[] bytes = in.getBytes("UTF8"); sum = md.digest(bytes); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } return sum; } }