igpp.util
Class Digest

java.lang.Object
  extended by igpp.util.Digest

public class Digest
extends Object

Create message digests (checksums) for phrases or files.

Version:
1.00 05/09/14
Author:
Todd King

Constructor Summary
Digest()
           
 
Method Summary
static String byteArrayToHexString(byte[] in)
          Convert a byte[] array to readable string format.
static String digestFile(String pathName)
          Create a message digest for a file using any supported digest method.
static String digestFile(String method, String pathName)
          Create a message digest for a file using any supported digest method.
static String digestPhrase(String phrase)
          Create a message digest for a phrase using the MD5 method.
static String digestPhrase(String method, String phrase)
          Create a message digest for a phrase using any supported digest method.
static long lastModified(String pathName)
          Determine when a file was last modified.
static void main(String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Digest

public Digest()
Method Detail

main

public static void main(String[] args)

lastModified

public static long lastModified(String pathName)
Determine when a file was last modified. Returns 0 if any error occurs.


digestPhrase

public static String digestPhrase(String phrase)
                           throws Exception
Create a message digest for a phrase using the MD5 method.

Throws:
Exception

digestPhrase

public static String digestPhrase(String method,
                                  String phrase)
                           throws Exception
Create a message digest for a phrase using any supported digest method.

Throws:
Exception

digestFile

public static String digestFile(String pathName)
                         throws Exception
Create a message digest for a file using any supported digest method.

Throws:
Exception

digestFile

public static String digestFile(String method,
                                String pathName)
                         throws Exception
Create a message digest for a file using any supported digest method.

Throws:
Exception

byteArrayToHexString

public static String byteArrayToHexString(byte[] in)
Convert a byte[] array to readable string format. This makes the "hex" readable!

Parameters:
in - byte[] buffer to convert to string format
Returns:
result String buffer in String format


Copyright © 2008-2009 Regents University of California. All Rights Reserved.