All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class cryptix.security.SHA

java.lang.Object
   |
   +----cryptix.security.MessageDigest
           |
           +----cryptix.security.SHA

public class SHA
extends MessageDigest
implements Cloneable
Note: SHA is deprecated.

This class implements the SHA-1 message digest algorithm.

References:

  1. NIST FIPS PUB 180-1, "Secure Hash Standard", U.S. Department of Commerce, May 1993.
    http://www.itl.nist.gov/div897/pubs/fip180-1.htm

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

$Revision: 1.4 $

Author:
Systemics Ltd, David Hopwood

Variable Index

 o DATA_LENGTH
Length of a block (the number of bytes hashed in every transform).
 o HASH_LENGTH
Length of the final hash (in bytes).

Constructor Index

 o SHA()
This creates an SHA-1 message digest instance.

Method Index

 o CreateHash(byte[])
Returns a HashSHA object whose value as a byte array is hash. Deprecated.
 o hash(byte[])
Returns the SHA-1 hash of a single byte array. Deprecated.
 o hash(String)
Returns the SHA-1 hash of a single string. Deprecated.
 o hashAsMessageHash(byte[])
Returns the MessageHash of a single byte array. Deprecated.
 o hashAsMessageHash(String)
Returns the MessageHash of a single string. Deprecated.
 o main(String[])
 o self_test(PrintWriter)

Variables

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

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

Constructors

 o SHA
 public SHA()
This creates an SHA-1 message digest instance.

Methods

 o hash
 public static byte[] hash(String str)
Note: hash() is deprecated. Use MessageDigest.getInstance("SHA-1", "Cryptix").digest(cryptix.mime.LegacyString.toByteArray(str)) instead.

Returns the SHA-1 hash of a single string.

Parameters:
str - the string to hash.
 o hash
 public static byte[] hash(byte data[])
Note: hash() is deprecated. Use MessageDigest.getInstance("SHA-1", "Cryptix").digest(data) instead.

Returns the SHA-1 hash of a single byte array.

Parameters:
msg - the byte array to hash.
 o hashAsMessageHash
 public static HashSHA hashAsMessageHash(String str)
Note: hashAsMessageHash() is deprecated. Use MessageHash.fromDigest(MessageDigest.getInstance("SHA-1", "Cryptix"), cryptix.mime.LegacyString.toByteArray(str)) instead.

Returns the MessageHash of a single string.

Parameters:
msg - the string to hash.
 o hashAsMessageHash
 public static HashSHA hashAsMessageHash(byte data[])
Note: hashAsMessageHash() is deprecated. Use MessageHash.fromDigest(MessageDigest.getInstance("SHA-1", "Cryptix"), data) instead.

Returns the MessageHash of a single byte array.

Parameters:
data - the byte array to hash.
 o CreateHash
 public static HashSHA CreateHash(byte hash[])
Note: CreateHash() is deprecated. Use new MessageHash("SHA-1", hash) instead.

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

 o main
 public static void main(String args[])
 o self_test
 public static void self_test(PrintWriter out) throws Exception

All Packages  Class Hierarchy  This Package  Previous  Next  Index