Here you can find the source of generateSaltedSHAHash(String algorithm, String input, String salt)
static public String generateSaltedSHAHash(String algorithm, String input, String salt) throws NoSuchAlgorithmException
//package com.java2s; /**/*w ww.j a v a 2 s. c om*/ * OWASP GoatDroid Project * * This file is part of the Open Web Application Security Project (OWASP) * GoatDroid project. For details, please see * https://www.owasp.org/index.php/Projects/OWASP_GoatDroid_Project * * Copyright (c) 2012 - The OWASP Foundation * * GoatDroid is published by OWASP under the GPLv3 license. You should read and accept the * LICENSE before you use, modify, and/or redistribute this software. * * @author Jack Mannino (Jack.Mannino@owasp.org https://www.owasp.org/index.php/User:Jack_Mannino) * @created 2012 */ import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Main { static public String generateSaltedSHAHash(String algorithm, String input, String salt) throws NoSuchAlgorithmException { MessageDigest md = MessageDigest.getInstance(algorithm); md.update(salt.getBytes()); byte byteData[] = md.digest(input.getBytes()); // convert the byte to hex format method 1 StringBuffer sb = new StringBuffer(); for (int i = 0; i < byteData.length; i++) { sb.append(Integer.toString((byteData[i] & 0xff) + 0x100, 16).substring(1)); } return sb.toString(); } }