org.apache.java.security
Class MD5

java.lang.Object
  |
  +--org.apache.java.security.MessageDigest
        |
        +--org.apache.java.security.MD5

public final class MD5
extends MessageDigest

This class implements the Message Digest 5 algorithm (MD5) as defined in RFC-1321.

Note: even if standard Java 1.1 APIs already provide a MD5 implementation, this class is used on those Java runtime environments (like Kaffe) where the package java.security is highly improbable to be found.


Field Summary
(package private) static byte[] padding
          MD5 Functions
 
Constructor Summary
MD5()
          Creates the algorithm and reset its state.
 
Method Summary
 void append(byte[] block, int offset, int length)
          Append another block of specified length to the message starting at the given offset.
 byte[] digest(byte[] block, int offset, int length)
          Appends a message block with specified length starting from the given offset and return its message digest.
static void main(String[] ignored)
           
 void reset()
          Resets the state of the class.
static byte[] toBytes(long n)
          Converts a long to a 8-byte array using low order first.
 
Methods inherited from class org.apache.java.security.MessageDigest
append, append, digest, digest
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

padding

static byte[] padding
MD5 Functions
Constructor Detail

MD5

public MD5()
Creates the algorithm and reset its state.
Method Detail

append

public void append(byte[] block,
                   int offset,
                   int length)
Append another block of specified length to the message starting at the given offset.
Overrides:
append in class MessageDigest

digest

public byte[] digest(byte[] block,
                     int offset,
                     int length)
Appends a message block with specified length starting from the given offset and return its message digest.
Overrides:
digest in class MessageDigest

main

public static final void main(String[] ignored)

reset

public void reset()
Resets the state of the class. Beware: calling this method erases all data previously inserted.
Overrides:
reset in class MessageDigest

toBytes

public static byte[] toBytes(long n)
Converts a long to a 8-byte array using low order first.