protected String generateUserPasswordLine(User user,String realm){
  String toHash=user.getName() + ":" + realm+ ":"+ user.getPassword();
  byte[] hash;
  try {
    hash=md5.digest(toHash.getBytes("UTF-8"));
  }
 catch (  UnsupportedEncodingException e) {
    throw new CargoException("Cannot encode one line for the " + "application-users.properties file",e);
  }
  StringBuilder sb=new StringBuilder();
  sb.append(user.getName());
  sb.append("=");
  for (  byte hashByte : hash) {
    sb.append(String.format("%02x",hashByte));
  }
  sb.append('\n');
  return sb.toString();
}

protected String generateUserPasswordLine ( User user , String realm ) { String toHash = user . getName ( ) + ":" + realm + ":" + user . getPassword ( ) ; byte [ ] hash ; try { hash = md5 . digest ( toHash . getBytes ( "UTF-8" ) ) ; } catch ( UnsupportedEncodingException e ) { throw new CargoException ( "Cannot encode one line for the " + "application-users.properties file" , e ) ; } StringBuilder sb = new StringBuilder ( ) ; sb . append ( user . getName ( ) ) ; sb . append ( "=" ) ; for ( byte hashByte : hash ) { sb . append ( String . format ( "%02x" , hashByte ) ) ; } sb . append ( '\n' ) ; return sb . toString ( ) ; }
generate the user and password line for th jboss users properties file .
