package common;

import java.security.MessageDigest;

import javax.xml.bind.DatatypeConverter;

/**
 * 
 * @author Marcos García Núñez (mgarcianun@uoc.edu)
 *
 */
public class HashUtils {

	public static String hashMD5(String stringValue) {
		byte[] digest = null;

		try {
			MessageDigest md = MessageDigest.getInstance("MD5");
			md.update(stringValue.getBytes());
			digest = md.digest();
		} catch (Exception ex) {
			// TODO: Register exception to log.
		}

		return (DatatypeConverter.printHexBinary(digest).toUpperCase());
	}

}
