Here you can find the source of encryptPassword(String unencrypted)
public static String encryptPassword(String unencrypted) throws NoSuchAlgorithmException
//package com.java2s; //License from project: Open Source License import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import javax.xml.bind.DatatypeConverter; public class Main { private final static String SHA_256 = "SHA-256"; public static String encryptPassword(String unencrypted) throws NoSuchAlgorithmException { MessageDigest md = MessageDigest.getInstance(SHA_256); md.update(unencrypted.getBytes()); return DatatypeConverter.printHexBinary(md.digest()).toLowerCase(); }// w w w.j av a 2 s.c o m }