import org.apache.commons.codec.digest.DigestUtils; String password = "123456"; String result = DigestUtils.sha256Hex(password);