org.apache.james.security
Class DigestUtil

java.lang.Object
  |
  +--org.apache.james.security.DigestUtil

public class DigestUtil
extends Object

Computes and verifies digests of files and strings

Version:
$Revision: 1.9 $
Author:
Charles Benett

Method Summary
static void digestFile(String filename, String algorithm)
          Calculate digest of given file with given algorithm.
static String digestString(String pass, String algorithm)
          Calculate digest of given String using given algorithm.
static void main(String[] args)
          Command line interface.
static void printUsage()
          Print the command line usage string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

main

public static void main(String[] args)
Command line interface. Use -help for arguments.

Parameters:
args - the arguments passed in on the command line

printUsage

public static void printUsage()
Print the command line usage string.


digestFile

public static void digestFile(String filename,
                              String algorithm)
Calculate digest of given file with given algorithm. Writes digest to file named filename.algorithm .

Parameters:
filename - the String name of the file to be hashed
algorithm - the algorithm to be used to compute the digest

digestString

public static String digestString(String pass,
                                  String algorithm)
                           throws NoSuchAlgorithmException
Calculate digest of given String using given algorithm. Encode digest in MIME-like base64.

Parameters:
pass - the String to be hashed
algorithm - the algorithm to be used
Returns:
String Base-64 encoding of digest
Throws:
NoSuchAlgorithmException - if the algorithm passed in cannot be found


"Copyright © 1999-2002 Apache Jakarta Project. All Rights Reserved."