SunSPOT host API V3.0


com.sun.squawk.security.signing
Class SHA

java.lang.Object
  extended by com.sun.squawk.security.signing.SHA

public final class SHA
extends Object


Field Summary
static byte ALG_SHA
          Message Digest algorithm SHA.
 
Constructor Summary
SHA()
           
 
Method Summary
 int doFinal(byte[] inBuf, int inOff, int inLen, byte[] outBuf, int outOff)
          Generates a hash of all/last input data.
 byte getAlgorithm()
          Gets the message digest algorithm.
 byte getLength()
          Returns the byte length of the hash.
 void reset()
          Resets the MessageDigest to the initial state for further use.
 void update(byte[] input, int offset, int len)
          Accumulates a hash of the input data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALG_SHA

public static final byte ALG_SHA
Message Digest algorithm SHA.

See Also:
Constant Field Values
Constructor Detail

SHA

public SHA()
Method Detail

getAlgorithm

public byte getAlgorithm()
Gets the message digest algorithm.

Returns:
the algorithm code defined above

getLength

public byte getLength()
Returns the byte length of the hash.

Returns:
hash length

reset

public void reset()
Resets the MessageDigest to the initial state for further use.


update

public void update(byte[] input,
                   int offset,
                   int len)
Accumulates a hash of the input data. This method requires temporary storage of intermediate results. In addition, if the input data length is not block aligned (multiple of block size) then additional internal storage may be allocated at this time to store a partial input data block. This may result in additional resource consumption and/or slow performance. This method should only be used if all the input data required for the hash is not available in one byte array. If all of the input data required for the hash is located in a single byte array, use of the doFinal() method is recommended. The doFinal() method must be called to complete processing of input data accumulated by one or more calls to the update() method.

Note:

Parameters:
inBuff - the input buffer of data to be hashed
inOffset - the offset into the input buffer at which to begin hash generation
inLength - the byte length to hash
See Also:
doFinal(byte[], int, int, byte[], int)

doFinal

public int doFinal(byte[] inBuf,
                   int inOff,
                   int inLen,
                   byte[] outBuf,
                   int outOff)
Generates a hash of all/last input data. Completes and returns the hash computation after performing final operations such as padding. The MessageDigest object is reset to the initial state after this call is made.

The input and output buffer data may overlap.

Parameters:
inBuff - the input buffer of data to be hashed
inOffset - the offset into the input buffer at which to begin hash generation
inLength - the byte length to hash
outBuff - the output buffer, may be the same as the input buffer
outOffset - the offset into the output buffer where the resulting hash value begins
Returns:
number of bytes of hash output in outBuff

SunSPOT host API V3.0


Copyright © 2006, 2007 Sun Microsystems, Inc. All Rights Reserved.