You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by pg...@apache.org on 2002/08/15 23:15:51 UTC

cvs commit: jakarta-james/src/java/org/apache/james/security package.html DigestUtil.java

pgoldstein    2002/08/15 14:15:51

  Modified:    src/java/org/apache/james/security DigestUtil.java
  Added:       src/java/org/apache/james/security package.html
  Log:
  Added extensive commenting.
  Added a private constructor to prevent instatiation of a utility class
  
  Revision  Changes    Path
  1.5       +17 -8     jakarta-james/src/java/org/apache/james/security/DigestUtil.java
  
  Index: DigestUtil.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/security/DigestUtil.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DigestUtil.java	7 Aug 2002 23:35:05 -0000	1.4
  +++ DigestUtil.java	15 Aug 2002 21:15:51 -0000	1.5
  @@ -16,7 +16,7 @@
   
   
   /**
  - * Class to compute and verify digests of files and strings
  + * Computes and verifies digests of files and strings
    *
    * @author <a href="mailto:charles@benett1.demon.co.uk">Charles Benett</a>
    *
  @@ -26,7 +26,9 @@
   public class DigestUtil {
   
       /**
  -     * Command line interface. Use -help for arguments
  +     * Command line interface. Use -help for arguments.
  +     *
  +     * @param args the arguments passed in on the command line
        */
       public static void main(String[] args) {
   
  @@ -68,7 +70,7 @@
       }
   
       /**
  -     * For CLI only
  +     * Print the command line usage string.
        */
       public static void printUsage() {
           System.out.println("Usage: " 
  @@ -79,10 +81,10 @@
   
       /**
        * Calculate digest of given file with given algorithm.
  -     * Writes digest to file named filename.algorithm
  +     * Writes digest to file named filename.algorithm .
        *
        * @param filename the String name of the file to be hashed
  -     * @param algorithm the algorithm to be used
  +     * @param algorithm the algorithm to be used to compute the digest
        */
       public static void digestFile(String filename, String algorithm) {
           byte[] b = new byte[65536];
  @@ -120,11 +122,13 @@
   
       /**
        * Calculate digest of given String using given algorithm.
  -     * Encode digest in MIME-like base64
  +     * Encode digest in MIME-like base64.
        *
        * @param pass the String to be hashed
        * @param algorithm the algorithm to be used
        * @return String Base-64 encoding of digest
  +     *
  +     * @throws NoSuchAlgorithmException if the algorithm passed in cannot be found
        */
       public static String digestString(String pass, String algorithm )
               throws NoSuchAlgorithmException  {
  @@ -145,4 +149,9 @@
               throw new RuntimeException("Fatal error: " + me);
           }
       }
  +
  +    /**
  +     * Private constructor to prevent instantiation of the class
  +     */
  +    private DigestUtil() {}
   }
  
  
  
  1.1                  jakarta-james/src/java/org/apache/james/security/package.html
  
  Index: package.html
  ===================================================================
  <body>
  <p>Provides classes implementing security related functionality.</p>
  <p>TODO: Should probably rearrange class hierarchy and eliminate this package.</p>
  </body>
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>