Here you can find the source of digest(String value, byte[] salt, int iterations)
public static byte[] digest(String value, byte[] salt, int iterations) throws NoSuchAlgorithmException, UnsupportedEncodingException
//package com.java2s; //License from project: Open Source License import java.io.UnsupportedEncodingException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Main { private static final String digestAlgorithm = "SHA-512"; private static final String stringEncoding = "UTF-8"; public static byte[] digest(String value, byte[] salt, int iterations) throws NoSuchAlgorithmException, UnsupportedEncodingException { MessageDigest digest = MessageDigest.getInstance(digestAlgorithm); digest.reset();/*from ww w . j av a 2 s .c o m*/ digest.update(salt); byte[] byteValue = digest.digest(value.getBytes(stringEncoding)); for (int i = 0; i < iterations; ++i) { digest.reset(); byteValue = digest.digest(byteValue); } return byteValue; } }