nl.justobjects.toolkit.sys
Class MD5

java.lang.Object
  |
  +--nl.justobjects.toolkit.sys.MD5

public class MD5
extends java.lang.Object


Field Summary
private  byte[] buffer
           
private static int BUFFER_SIZE
           
private  long count
           
private  byte[] digest
           
private  java.io.InputStream in
           
private static byte[] padding
           
private static int S11
           
private static int S12
           
private static int S13
           
private static int S14
           
private static int S21
           
private static int S22
           
private static int S23
           
private static int S24
           
private static int S31
           
private static int S32
           
private static int S33
           
private static int S34
           
private static int S41
           
private static int S42
           
private static int S43
           
private static int S44
           
private  int[] state
           
private  boolean stringp
           
 
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
static java.lang.String createStringDigest(java.lang.String aString)
           
private  void decode(int[] output, byte[] input, int off, int len)
           
private  byte[] encode(int[] input, int len)
           
private  byte[] end()
           
private  int F(int x, int y, int z)
           
private  int FF(int a, int b, int c, int d, int x, int s, int ac)
           
private  int G(int x, int y, int z)
           
 byte[] getDigest()
          Get the digest for our input stream.
 java.lang.String getStringDigest()
          Get the digest, as a proper string.
private  int GG(int a, int b, int c, int d, int x, int s, int ac)
           
private  int H(int x, int y, int z)
           
private  int HH(int a, int b, int c, int d, int x, int s, int ac)
           
private  int I(int x, int y, int z)
           
private  int II(int a, int b, int c, int d, int x, int s, int ac)
           
static void main(java.lang.String[] args)
           
 byte[] processString()
          Get the digest, for this string digestifier.
private  int rotate_left(int x, int n)
           
private static java.lang.String stringify(byte[] buf)
           
private  void transform(byte[] block, int offset)
           
private  void update(byte[] input, int len)
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

BUFFER_SIZE

private static final int BUFFER_SIZE

S11

private static final int S11

S12

private static final int S12

S13

private static final int S13

S14

private static final int S14

S21

private static final int S21

S22

private static final int S22

S23

private static final int S23

S24

private static final int S24

S31

private static final int S31

S32

private static final int S32

S33

private static final int S33

S34

private static final int S34

S41

private static final int S41

S42

private static final int S42

S43

private static final int S43

S44

private static final int S44

padding

private static byte[] padding

in

private java.io.InputStream in

stringp

private boolean stringp

state

private int[] state

count

private long count

buffer

private byte[] buffer

digest

private byte[] digest
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

stringify

private static java.lang.String stringify(byte[] buf)

F

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

G

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

H

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

I

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

rotate_left

private final int rotate_left(int x,
                              int n)

FF

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

GG

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

HH

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

II

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

decode

private final void decode(int[] output,
                          byte[] input,
                          int off,
                          int len)

transform

private final void transform(byte[] block,
                             int offset)

update

private final void update(byte[] input,
                          int len)

end

private byte[] end()

encode

private byte[] encode(int[] input,
                      int len)

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.

createStringDigest

public static java.lang.String createStringDigest(java.lang.String aString)
                                           throws java.io.IOException

main

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


Copyright © 2000-2001 - Just Objects B.V.