Java tutorial
//package com.java2s; import java.nio.charset.Charset; import org.apache.commons.codec.digest.DigestUtils; public class Main { public static final Charset charset = Charset.forName("utf-8"); public static final String MD5(byte[] bytes) { return DigestUtils.md5Hex(bytes); } public static final String MD5(String str) { return DigestUtils.md5Hex(str.getBytes(charset)); } }