Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## 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.

Version:
  $Revision: 1.4 $ $Date: 1999/04/26 00:33:56 $

Field Summary
`private byte[]` | `buffer`
`private long` | `counter`
`private static java.lang.String[]` | `digests`
`private static java.lang.String[]` | `messages` Self Test
`(package private) static byte[]` | `padding` MD5 Functions
`private int` | `reminder`
`private int[]` | `state`
`private int[]` | `x`

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.
`private static void` | `byte2int(byte[] in, int[] out)` Converts a 64-byte array into a 16-int array.
`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.
`private static int` | `F(int x, int y, int z)`
`private static int` | `FF(int a, int b, int c, int d, int x, int s, int ac)`
`private static int` | `G(int x, int y, int z)`
`private static int` | `GG(int a, int b, int c, int d, int x, int s, int ac)`
`private static int` | `H(int x, int y, int z)`
`private static int` | `HH(int a, int b, int c, int d, int x, int s, int ac)`
`private static int` | `I(int x, int y, int z)`
`private static int` | `II(int a, int b, int c, int d, int x, int s, int ac)`
`private static void` | `int2byte(int[] in, byte[] out)` Converts a 4-int array into a 16-byte array.
`static void` | `main(java.lang.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.
`private void` | `transform(byte[] buffer)`

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, registerNatives, toString, wait, wait, wait`

Field Detail

### counter

    private long counter

### reminder

    private int reminder

### buffer

    private byte[] buffer

### state

    private int[] state

### x

    private int[] x

### padding

    static byte[] padding

  MD5 Functions

### messages

    private static java.lang.String[] messages

  Self Test

### digests

    private static java.lang.String[] digests

Constructor Detail

### MD5

    public MD5()

  Creates the algorithm and reset its state.

Method Detail

### reset

    public void reset()

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

### 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

### byte2int

    private static void byte2int(byte[] in,
                                 int[] out)

  Converts a 64-byte array into a 16-int array.

### int2byte

    private static void int2byte(int[] in,
                                 byte[] out)

  Converts a 4-int array into a 16-byte array.

### toBytes

    public static byte[] toBytes(long n)

  Converts a long to a 8-byte array using low order first.

### F

    private static int F(int x,
                         int y,
                         int z)

### G

    private static int G(int x,
                         int y,
                         int z)

### H

    private static int H(int x,
                         int y,
                         int z)

### I

    private static int I(int x,
                         int y,
                         int z)

### FF

    private static int FF(int a,
                          int b,
                          int c,
                          int d,
                          int x,
                          int s,
                          int ac)

### GG

    private static int GG(int a,
                          int b,
                          int c,
                          int d,
                          int x,
                          int s,
                          int ac)

### HH

    private static int HH(int a,
                          int b,
                          int c,
                          int d,
                          int x,
                          int s,
                          int ac)

### II

    private static int II(int a,
                          int b,
                          int c,
                          int d,
                          int x,
                          int s,
                          int ac)

### transform

    private void transform(byte[] buffer)

### main

    public static final void main(java.lang.String[] ignored)

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD