cryptix.security
Class MD5

java.lang.Object
  |
  +--cryptix.security.MessageDigest
        |
        +--cryptix.security.MD5
All Implemented Interfaces:
java.lang.Cloneable

public class MD5
extends MessageDigest
implements java.lang.Cloneable

This class implements the Cryptix V2.2 API for the the MD5 message digest algorithm. New code should use the JCA implementation of MD5, which can be obtained by calling MessageDigest.getInstance("MD5"), for example.

References:

  1. Bruce Schneier, "Section 18.5 MD5," Applied Cryptography, 2nd edition, John Wiley & Sons, 1996

  2. RFC 1321 [need complete reference]

Copyright © 1995-1997 Systemics Ltd on behalf of the Cryptix Development Team.
All rights reserved.

$Revision: 1.4 $

Since:
Cryptix 2.2
Author:
Systemics Ltd, David Hopwood

Field Summary
static int DATA_LENGTH
          Deprecated. Length of a block (the number of bytes hashed in every transform).
static int HASH_LENGTH
          Deprecated. Length of the final hash (in bytes).
 
Constructor Summary
MD5()
          Deprecated. This creates an MD5 message digest instance.
 
Method Summary
static HashMD5 CreateHash(byte[] hash)
          Deprecated. Use new MessageHash("MD5", hash) instead.
static byte[] hash(byte[] data)
          Deprecated. Use MessageDigest.getInstance("MD5", "Cryptix").digest(data) instead.
static byte[] hash(java.lang.String str)
          Deprecated. Use MessageDigest.getInstance("MD5", "Cryptix").digest(cryptix.mime.LegacyString.toByteArray(str)) instead.
static HashMD5 hashAsMessageHash(byte[] data)
          Deprecated. Use MessageHash.fromDigest(MessageDigest.getInstance("MD5", "Cryptix"), data) instead.
static HashMD5 hashAsMessageHash(java.lang.String str)
          Deprecated. Use MessageHash.fromDigest(MessageDigest.getInstance("MD5", "Cryptix"), cryptix.mime.LegacyString.toByteArray(str)) instead.
static void main(java.lang.String[] args)
          Deprecated.  
static void self_test(java.io.PrintWriter out)
          Deprecated.  
 
Methods inherited from class cryptix.security.MessageDigest
add, add, add, add, digest, digest, digestAsHash, hash_length, hash, hash, length, name, reset
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HASH_LENGTH

public static final int HASH_LENGTH
Deprecated. 
Length of the final hash (in bytes).

DATA_LENGTH

public static final int DATA_LENGTH
Deprecated. 
Length of a block (the number of bytes hashed in every transform).
Constructor Detail

MD5

public MD5()
Deprecated. 
This creates an MD5 message digest instance.
Method Detail

hash

public static byte[] hash(java.lang.String str)
Deprecated. Use MessageDigest.getInstance("MD5", "Cryptix").digest(cryptix.mime.LegacyString.toByteArray(str)) instead.

Returns the MD5 hash of a single string.
Parameters:
str - the string to hash.

hash

public static byte[] hash(byte[] data)
Deprecated. Use MessageDigest.getInstance("MD5", "Cryptix").digest(data) instead.

Returns the MD5 hash of a single byte array.
Parameters:
msg - the byte array to hash.

hashAsMessageHash

public static HashMD5 hashAsMessageHash(java.lang.String str)
Deprecated. Use MessageHash.fromDigest(MessageDigest.getInstance("MD5", "Cryptix"), cryptix.mime.LegacyString.toByteArray(str)) instead.

Returns the MessageHash of a single string.
Parameters:
msg - the string to hash.

hashAsMessageHash

public static HashMD5 hashAsMessageHash(byte[] data)
Deprecated. Use MessageHash.fromDigest(MessageDigest.getInstance("MD5", "Cryptix"), data) instead.

Returns the MessageHash of a single byte array.
Parameters:
data - the byte array to hash.

CreateHash

public static HashMD5 CreateHash(byte[] hash)
Deprecated. Use new MessageHash("MD5", hash) instead.

Returns a HashMD5 object whose value as a byte array is hash.

main

public static void main(java.lang.String[] args)
Deprecated. 

self_test

public static void self_test(java.io.PrintWriter out)
                      throws java.lang.Exception
Deprecated.