edu.berkeley.psi.tagged.api
Class SHA1Digest

java.lang.Object
  extended by edu.berkeley.psi.tagged.api.Tagged
      extended by edu.berkeley.psi.tagged.api.Digest
          extended by edu.berkeley.psi.tagged.api.SHA1Digest
All Implemented Interfaces:
TaggedIF, XdrAble

public class SHA1Digest
extends Digest

Represents a SHA-1 hash digest result. It will normally be XDR-serialized as a 4-byte tag followed by a 20-byte hash value.


Field Summary
protected static int SHA1_LENGTH
          The expected size of a SHA-1 digest
 
Fields inherited from class edu.berkeley.psi.tagged.api.Digest
data, DEFAULT_ALGORITHM, DEFAULT_ALGORITHM_ID, MD2, MD5, SHA1, SHA256, SHA384, SHA512
 
Fields inherited from class edu.berkeley.psi.tagged.api.Tagged
classes, initLock
 
Constructor Summary
SHA1Digest(byte[] data)
          Create a Digest with a shared byte[] buffer
 
Method Summary
 java.lang.String getAlgorithm()
          Return the algorithm name for MessageDigest
 int getAlgorithmId()
          An integer index for the algorithm
(package private) static Digest newInstance()
          Create an unintialized SHA1Digest object for use by xdrDecode().
static Digest newInstance(byte[] data)
           
static int staticTag()
          The class tag used for XdrDecode disambiguation.
 void xdrDecode(XdrDecodingStream xdr)
          Deserialize a SHA1Digest from the XdrDecodingStream
 void xdrEncode(XdrEncodingStream xdr)
          Serialize a SHA1Digest to a XdrEncodingStream
 
Methods inherited from class edu.berkeley.psi.tagged.api.Digest
bytes, factory, getAlgorithm, getAlgorithmId, getDigestLength
 
Methods inherited from class edu.berkeley.psi.tagged.api.Tagged
addClass, addClass, digest, digest, digestWith, get, getBody, getTag, newInstance, put, put, putBody, putTag
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SHA1_LENGTH

protected static final int SHA1_LENGTH
The expected size of a SHA-1 digest

See Also:
Constant Field Values
Constructor Detail

SHA1Digest

SHA1Digest(byte[] data)
Create a Digest with a shared byte[] buffer

Method Detail

getAlgorithm

public java.lang.String getAlgorithm()
Return the algorithm name for MessageDigest

Specified by:
getAlgorithm in class Digest

getAlgorithmId

public int getAlgorithmId()
An integer index for the algorithm

Specified by:
getAlgorithmId in class Digest

staticTag

public static int staticTag()
The class tag used for XdrDecode disambiguation.


newInstance

public static Digest newInstance(byte[] data)

xdrDecode

public void xdrDecode(XdrDecodingStream xdr)
               throws OncRpcException,
                      java.io.IOException
Deserialize a SHA1Digest from the XdrDecodingStream

Parameters:
xdr - XDR stream from which decoded information is retrieved.
Throws:
OncRpcException - if an ONC/RPC error occurs.
java.io.IOException - if an I/O error occurs.

xdrEncode

public void xdrEncode(XdrEncodingStream xdr)
               throws OncRpcException,
                      java.io.IOException
Serialize a SHA1Digest to a XdrEncodingStream

Parameters:
xdr - XDR stream to which information is sent for encoding.
Throws:
OncRpcException - if an ONC/RPC error occurs.
java.io.IOException - if an I/O error occurs.

newInstance

static Digest newInstance()
Create an unintialized SHA1Digest object for use by xdrDecode().