Here you can find the source of hash(char[] pin, byte[] salt)
private static byte[] hash(char[] pin, byte[] salt) throws NoSuchAlgorithmException, InvalidKeySpecException
//package com.java2s; import java.security.NoSuchAlgorithmException; import java.security.spec.InvalidKeySpecException; import java.util.Arrays; import javax.crypto.SecretKeyFactory; import javax.crypto.spec.PBEKeySpec; public class Main { private static final int ROUNDS = 100; private static final int KEY_LEN = 256; private static final String KEY_ALGORITHM = "PBKDF2WithHmacSHA1"; private static byte[] hash(char[] pin, byte[] salt) throws NoSuchAlgorithmException, InvalidKeySpecException { PBEKeySpec spec = new PBEKeySpec(pin, salt, ROUNDS, KEY_LEN); Arrays.fill(pin, Character.MIN_VALUE); try {//from w w w. j a v a 2 s. c om SecretKeyFactory skf = SecretKeyFactory .getInstance(KEY_ALGORITHM); return skf.generateSecret(spec).getEncoded(); } finally { spec.clearPassword(); } } }