Class PHCFormatUtil

java.lang.Object
org.seppiko.commons.utils.crypto.PHCFormatUtil

public class PHCFormatUtil extends Object
PHC(Password Hashing Competition) String Format utility
Author:
Leonard Woo
See Also:
  • Method Details

    • format

      public static String format(String id, String version, Map<String,Object> params, String salt, String hash)
      Format to PHC String
      
         $<id>[$v=<version>][$<param>=<value>(,<param>=<value>)*][$<salt>[$<hash>]]
       
      Parameters:
      id - The symbolic name for the function.
      version - The algorithm version. May be null or empty.
      params - A parameter map. May be null or empty. But value must be implementation Object.toString().
      salt - An encoding of the salt. May be null or empty.
      hash - An encoding of the hash output. May be null or empty, but must be with salt.
      Returns:
      PHC String
    • format

      public static String format(PHCFormatUtil.Entity entity)
      Format to PHC String
      
         $<id>[$v=<version>][$<param>=<value>(,<param>=<value>)*][$<salt>[$<hash>]]
       
      Parameters:
      entity - PHC String Entity
      Returns:
      PHC String
    • parser

      public static PHCFormatUtil.Entity parser(String phc)
      Parse PHC String format
      Parameters:
      phc - PHC String
      Returns:
      PHC String Entity