public static String generateSourceID(String entityID){
  if ((entityID == null) || (entityID.length() == 0)) {
    return null;
  }
  MessageDigest md=null;
  try {
    md=MessageDigest.getInstance("SHA");
  }
 catch (  NoSuchAlgorithmException e) {
    debug.error("SAML2Utils.generateSourceID: ",e);
    return null;
  }
  char chars[]=entityID.toCharArray();
  byte bytes[]=new byte[chars.length];
  for (int i=0; i < chars.length; i++) {
    bytes[i]=(byte)chars[i];
  }
  md.update(bytes);
  return SAML2Utils.byteArrayToString(md.digest());
}

public static String generateSourceID ( String entityID ) { if ( ( entityID == null ) || ( entityID . length ( ) == 0 ) ) { return null ; } MessageDigest md = null ; try { md = MessageDigest . getInstance ( "SHA" ) ; } catch ( NoSuchAlgorithmException e ) { debug . error ( "SAML2Utils.generateSourceID: " , e ) ; return null ; } char chars [ ] = entityID . toCharArray ( ) ; byte bytes [ ] = new byte [ chars . length ] ; for ( int i = 0 ; i < chars . length ; i ++ ) { bytes [ i ] = ( byte ) chars [ i ] ; } md . update ( bytes ) ; return SAML2Utils . byteArrayToString ( md . digest ( ) ) ; }
generates provider source id based on provider entity id . the returned is sha - 1 digest string .
