Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.ssttr.crypto
Class MD2  view MD2 download MD2.java

java.lang.Object
  extended bycom.ssttr.crypto.MessageDigest
      extended bycom.ssttr.crypto.MD2

public final class MD2
extends MessageDigest

The MD2 class is used to compute an MD2 message digest over a given buffer of bytes. It is an implementation of the RSA Data Security Inc MD2 algorithim as described in internet RFC 1319.

Version:
07 Aug 1995, 1.2

Field Summary
private  byte[] buffer
           
private  byte[] checksum
           
private  int count
           
private static byte[] PI_SUBST
          Permutation of 0..255 constructed from the digits of pi.
private  byte[] state
           
private static byte[] transformBuffer
           
 
Fields inherited from class com.ssttr.crypto.MessageDigest
digestBits, digestValid, testdata
 
Constructor Summary
MD2()
          Standard constructor, creates a new MD2 instance, allocates its buffers from the heap.
MD2(byte[] mydigest)
          Alternate constructor, allows you to pass in the buffer where you want the resulting digest stored.
 
Method Summary
 void finish()
          Perform the final computations, any buffered bytes are added to the digest, the count is added to the digest, and the resulting digest is stored.
 java.lang.String getAlg()
          Return a string that represents the algorithim of this message digest.
 void init()
          Initialize the MD2 state information and reset the counters.
private  void transform()
          perform the basic MD2 transformation.
 void update(byte b)
          update adds the passed type to the input buffer
 
Methods inherited from class com.ssttr.crypto.MessageDigest
benchmark, computeDigest, computeDigest, getDigest, getDigestBytes, getDigestHex, isEqual, isEqual, toString, update, update, update, update, update, update, update, update, update, update, update, updateASCII
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

state

private byte[] state

checksum

private byte[] checksum

count

private int count

buffer

private byte[] buffer

transformBuffer

private static byte[] transformBuffer

PI_SUBST

private static final byte[] PI_SUBST
Permutation of 0..255 constructed from the digits of pi. It gives a "random" nonlinear byte substitution operation.

Constructor Detail

MD2

public MD2()
Standard constructor, creates a new MD2 instance, allocates its buffers from the heap.


MD2

public MD2(byte[] mydigest)
Alternate constructor, allows you to pass in the buffer where you want the resulting digest stored.

Method Detail

transform

private void transform()
perform the basic MD2 transformation.


init

public void init()
Initialize the MD2 state information and reset the counters.

Specified by:
init in class MessageDigest

update

public void update(byte b)
update adds the passed type to the input buffer

Specified by:
update in class MessageDigest

finish

public void finish()
Perform the final computations, any buffered bytes are added to the digest, the count is added to the digest, and the resulting digest is stored. After calling final you will need to call init() again to do another digest.

Specified by:
finish in class MessageDigest

getAlg

public java.lang.String getAlg()
Description copied from class: MessageDigest
Return a string that represents the algorithim of this message digest.

Specified by:
getAlg in class MessageDigest