acg.blocks
Class NonceAO

java.lang.Object
  |
  +--acg.blocks.NonceAO

public class NonceAO
extends java.lang.Object
implements ACGObject

The NonceAO represents a nonce, which in this case is currently a random string of 128 bits.


Constructor Summary
NonceAO()
          Constructs an empty nonce.
NonceAO(java.security.SecureRandom generator)
          Constructs a nonce.
 
Method Summary
 boolean equals(NonceAO otherNonce)
           
 byte[] getNonceValue()
           
 byte getTypeID()
           
 int inputBytes(byte[] serialize, int start)
          Deserializes the NonceAO object.
static void main(java.lang.String[] args)
           
 byte[] outputBytes()
          Serializes the NonceAO object.
 boolean selfTest()
           
 void setAny(boolean any)
          Do nothing method, for interface compatibility.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NonceAO

public NonceAO()
Constructs an empty nonce. I'm not really sure why this is still here.

NonceAO

public NonceAO(java.security.SecureRandom generator)
Constructs a nonce.
Parameters:
generator - a SecureRandom object used to generate the nonce.
Method Detail

setAny

public void setAny(boolean any)
Do nothing method, for interface compatibility.
Specified by:
setAny in interface ACGObject
Tags copied from interface: ACGObject
Parameters:
any - True if the ACGObject should just return its data byte array.
See Also:
EncryptedAO

equals

public boolean equals(NonceAO otherNonce)
Parameters:
otherNonce - the nonce to be compared.
Returns:
true if this nonce is equal to otherNonce.

getNonceValue

public byte[] getNonceValue()

getTypeID

public byte getTypeID()
Specified by:
getTypeID in interface ACGObject
Returns:
a byte indicating this is of type nonce.

outputBytes

public byte[] outputBytes()
                   throws ACGException
Serializes the NonceAO object. 1 Type ID byte, 1 length byte, and 4 bytes of data.
Pos 0: TYPE_NONCE // type
Pos 1: nonceBytes //for now
Pos 2-5: XXXX XXXX XXXX XXXX// nonceBytes bytes for uniqueness
Specified by:
outputBytes in interface ACGObject
Returns:
a byte array with the serialized NonceAO object.
See Also:
inputBytes(byte[], int)

inputBytes

public int inputBytes(byte[] serialize,
                      int start)
               throws ACGException
Deserializes the NonceAO object.
Specified by:
inputBytes in interface ACGObject
Parameters:
serialize - the byte array from which to read the NonceAO
start - the index at which to start reading
Returns:
the number of bytes taken up by the serialized NonceAO object.
See Also:
outputBytes()

main

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

selfTest

public boolean selfTest()
                 throws ACGException