Hi all,

I am trying to implement code where I take a password then encode the
password with SHA512 and a Salt.

I have developed the Java code, and tested it in Eclipse and everything
is working swell!

Now I am trying to get this function into IDM so I can call it from a
Driver and it will return the Salt and the Digest.

Here is the code:

import java.io.UnsupportedEncodingException;
import java.security.*;

public class SHA512Salt {

private static StringBuffer getHash(String saltPass) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md = MessageDigest.getInstance("SHA-512");

byte byteData[] = md.digest();

//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;

private static String getRandomSalt() {
SecureRandom random = new SecureRandom();
long challange = random.nextLong();
String SaltRDM = Long.toHexString(challange).toLowerCase();
return SaltRDM;

public static String encPassword(String password) throws NoSuchAlgorithmException, UnsupportedEncodingException {
String rdmSalt = getRandomSalt();
String saltPass = rdmSalt.concat(password);
StringBuffer digest = getHash(saltPass);
return "SALTED"+rdmSalt+digest;


How can I get this into Desginer now? Do I need to convert it to

ccikara's Profile: http://forums.novell.com/member.php?userid=86966
View this thread: http://forums.novell.com/showthread.php?t=452466