|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.security.MessageDigestSpi | +--java.security.MessageDigest | +--iaik.security.md.AbstractMessageDigest | +--iaik.security.md.Md2
This class implements the MD2 message digest algorithm.
by Ron Rivestīs MD2 algorithm is described by Burt Kaliski in RFC 1319 (and previously in RFC 1115). It is a secure hash function that takes input of arbitrary length and produces an output of exactly 16 bytes (128 bit).
It is designed for 8 bit machines and therefore does not deliver optimum performance on todays processors with a wordsize of 32 and more bits. Additionally, some weaknesses have been found in the compression function employed by MD2, although the algorithm can still be considered secure because of a checksum that is appended to the data. Nevertheless we recommend using MD5 or even better SHA-1 both for speed and security reasons. Basically MD2 is implemented only to allow certain certificates from RSA Inc. and Verisign to be verified.
An excerpt from the original RFC1319 follows:
This document describes the MD2 message-digest algorithm. The algorithm takes as input a message of arbitrary length and produces as output a 128-bit "fingerprint" or "message digest" of the input. It is conjectured that it is computationally infeasible to produce two messages having the same message digest, or to produce any message having a given prespecified target message digest. The MD2 algorithm is intended for digital signature applications, where a large file must be "compressed" in a secure manner before being signed with a private (secret) key under a public-key cryptosystem such as RSA.
This class extends the java.security.MessageDigest
class
and applications should use one of the getInstance
methods
presented there to create a MessageDigest-MD2 object.
Generally, an application wishing to compute the message digest of some
data has to perform three steps:
getInstance
method, e.g.:
MessageDigest md2 = MessageDigest.getInstance("MD2");
update
methods,
e.g:
md2.update(m1); md2.update(m2); ...
digest
methods:
byte[] hash_value = md2.digest();
There are several ways for combining update
and
digest
methods for computing a message digest. Since
this class implements the Cloneable
interface,
MD2 MessageDigest objects may be used for compute intermediate
hashes through cloning (see
http://java.sun.com/products/JDK/1.1/docs/guide/security/CryptoSpec.html).
When the hash value successfully has been computed, the MD2 MessageDigest object automatically resets for being able to be supplied with new data to be hashed.
The MD2 algorithm may be combined with a public-key algorithm (e.g. RSA) to be used as digital signature algorithm (see iaik.security.rsa.Md2RSASignature).
Md2RSASignature
,
SHA
,
Md5
Constructor Summary | |
Md2()
Creates a new MD2 message digest object. |
Method Summary | |
Object |
clone()
Returns a clone of this Md2 Object. |
void |
destroyCriticalData()
|
protected byte[] |
engineDigest()
b>SPI: Completes the hash computation by performing final operations such as padding. |
int |
engineGetDigestLength()
SPI: Returns the length of the digest in bytes. |
void |
engineReset()
SPI: Resets this MD2 message digest object for being supplied with new data. |
protected void |
engineUpdate(byte input)
SPI: Updates the data to be hashed with the specified byte. |
protected void |
engineUpdate(byte[] input,
int offset,
int len)
SPI: Updates the data to be hashed with the specified number of bytes, beginning at the specified offset within the given byte array. |
protected void |
finalize()
|
Methods inherited from class java.security.MessageDigest |
digest, digest, digest, getAlgorithm, getDigestLength, getInstance, getInstance, getProvider, isEqual, reset, toString, update, update, update |
Methods inherited from class java.security.MessageDigestSpi |
engineDigest |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Md2()
Applications do not use this constructor. They shall use
for creating a MesssageDigest object.MessageDigest.getInstance("MD2");
MessageDigest.getInstance(java.lang.String)
Method Detail |
public Object clone()
clone
in class iaik.security.md.AbstractMessageDigest
public void engineReset()
This method is called by engineDigest
after the actual hash computation has been finished to automatically reset
the message digest object for being supplied with new data for starting a
new hash computation.
engineReset
in class iaik.security.md.AbstractMessageDigest
AbstractMessageDigest.engineDigest()
public void destroyCriticalData()
protected void finalize()
finalize
in class Object
protected final void engineUpdate(byte input)
engineUpdate
in class MessageDigestSpi
input
- the byte to be used for updating.protected final void engineUpdate(byte[] input, int offset, int len)
engineUpdate
in class MessageDigestSpi
input
- the byte array holding the data to be used for this update
operation.offset
- the offset, indicating the start position within the given
byte array.len
- the number of bytes to be obtained from the given byte array,
starting at the given position.protected byte[] engineDigest()
engineDigest
has been called, the engine should be
reset. Resetting is the responsibility of the engine implementor.engineDigest
in class MessageDigestSpi
AbstractMessageDigest.engineReset()
public int engineGetDigestLength()
May not be available for applications before JDK versions >= 1.2.x.
engineGetDigestLength
in class MessageDigestSpi
|
This Javadoc may contain text parts from Internet Standard specifications (RFC 2459, 3280, 3039, 2560, 1521, 821, 822, 2253, 1319, 1321, ,2630, 2631, 2268, 3058, 2984, 2104, 2144, 2040, 2311, 2279, see copyright note) and RSA Data Security Public-Key Cryptography Standards (PKCS#1,3,5,7,8,9,10,12, see copyright note). | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |