/**
  * Gets the encryption that has computed the specified digest.
  *
  * <p>As digests in password encryption are usually made up of an encryption algorithm identifier,
  * the factory can then find the algorithm that matches the specified digest. If the digest
  * doesn't contain any algorithm identifier, then the UnixDES is returned (yet it is the only one
  * supported by Silverpeas that doesn't generate an algorithm identifier in the digest). In the
  * case the identifier in the digest isn't known, then a exception is thrown.
  *
  * @param digest the digest from which the password encryption has be found.
  * @return the password encryption that has computed the specified digest.
  * @throws IllegalArgumentException if the digest was not computed by any of the password
  *     encryption supported in Silverpeas.
  */
 public static PasswordEncryption getPasswordEncryption(String digest)
     throws IllegalArgumentException {
   Set<PasswordEncryption> availableEncrypts =
       ServiceProvider.getAllServices(PasswordEncryption.class);
   PasswordEncryption encryption =
       availableEncrypts
           .stream()
           .filter(encrypt -> encrypt.doUnderstandDigest(digest))
           .findFirst()
           .orElseThrow(
               () ->
                   new IllegalArgumentException(
                       "Digest '"
                           + digest
                           + "' not understand by any of the available encryption in Silverpeas"));
   return encryption;
 }