org.w3c.tools.crypt
Class Md5

java.lang.Object
  extended by org.w3c.tools.crypt.Md5

public class Md5
extends java.lang.Object


Constructor Summary
Md5(java.io.InputStream in)
          Construct a digestifier for the given input stream.
Md5(java.lang.String input)
          Construct a digestifier for the given string.
Md5(java.lang.String input, java.lang.String enc)
          Construct a digestifier for the given string.
 
Method Summary
 byte[] getDigest()
          Get the digest for our input stream.
 java.lang.String getStringDigest()
          Get the digest, as a proper string.
static void main(java.lang.String[] args)
           
 byte[] processString()
          Get the digest, for this string digestifier.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Md5

public Md5(java.lang.String input,
           java.lang.String enc)
Construct a digestifier for the given string.

Parameters:
input - The string to be digestified.
encoding - the encoding name used (such as UTF8)

Md5

public Md5(java.lang.String input)
Construct a digestifier for the given string.

Parameters:
input - The string to be digestified.

Md5

public Md5(java.io.InputStream in)
Construct a digestifier for the given input stream.

Parameters:
in - The input stream to be digestified.
Method Detail

getDigest

public byte[] getDigest()
                 throws java.io.IOException
Get the digest for our input stream. This method constructs the input stream digest, and return it, as a a String, following the MD5 (rfc1321) algorithm,

Returns:
An instance of String, giving the message digest.
Throws:
java.io.IOException - Thrown if the digestifier was unable to read the input stream.

processString

public byte[] processString()
Get the digest, for this string digestifier. This method doesn't throw any IOException, since it knows that the underlying stream ws built from a String.


getStringDigest

public java.lang.String getStringDigest()
Get the digest, as a proper string.


main

public static void main(java.lang.String[] args)
                 throws java.io.IOException
Throws:
java.io.IOException