Java tutorial
//package com.java2s; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Main { public static byte[] SHA1(String text) { if (null == text) { return null; } try { MessageDigest messageDigest = MessageDigest.getInstance("SHA1"); messageDigest.update(text.getBytes()); return messageDigest.digest(); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); return null; } } }