View Single Post
Old 06-16-2004, 08:32 AM   #3 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,444
sde is on a distinguished road
well here is what i came up with after searching, .. but i want it to be like the 32 character hash that the php md5() function creates.
Code:
public static String encryptString(String str){
    byte[] originalByteArray = str.getBytes();
    String returnString = "";
    
    try{      
      MessageDigest digest = MessageDigest.getInstance("MD5");
      digest.reset();
      digest.update(originalByteArray);
      byte[]arr = digest.digest();
      returnString = arr.toString();
      
    }catch(Exception e){
      System.out.println("Error:encryptString()");
      return returnString;
    }
    
    return returnString;
  }
__________________
Mike
sde is offline   Reply With Quote