public static void Hash()

in UProveTestVectors/ProtocolHelper.cs [60:124]


        public static void Hash(HashAlgorithm hasher, object[] array)
        {
            byte[] buffer = new byte[] { (byte) 0, (byte) 0, (byte) 0, (byte) 0 };
    	    // handle each array element
            for (int i = 0; i < array.Length; i++)
            {
        	    if (array[i] == null)
                {
                    HashBytes(hasher, buffer);
                }
                else if (array[i] is byte)
                {
                    HashBytes(hasher, new byte[] { (byte) array[i] });
                }
                else if (array[i] is int)
                { 
                    int integer = (int) array[i];
                    HashSize(hasher, integer);
                }
                else if (array[i] is BigInteger)
                {
                    HashLenghtAndBytes(hasher, (array[i] as BigInteger).ToByteArrayUnsigned());
                }
                else if (array[i] is GroupElement)
                {
                    HashLenghtAndBytes(hasher, (array[i] as GroupElement).ToByteArray());
                }
                else if (array[i] is FpPoint)
                {
                    HashLenghtAndBytes(hasher, (array[i] as FpPoint).GetEncoded());
                }
                else if (array[i] is byte[])
                {
                    HashLenghtAndBytes(hasher, (array[i] as byte[]));
                }
                else if (array[i] is BigInteger[])
                {
                    BigInteger[] bi = (BigInteger[])array[i];
                    HashSize(hasher, bi.Length);
                    Hash(hasher, bi);
                }
                else if (array[i] is int[])
                {
                    int[] integers = (int[])array[i];
                    HashSize(hasher, integers.Length);
                    foreach (int integer in integers) { HashSize(hasher, integer); }
                }
                else if (array[i] is GroupElement[])
                {
                    GroupElement[] groupElements = (GroupElement[])array[i];
                    HashSize(hasher, groupElements.Length);
                    Hash(hasher, groupElements);
                }
                else if (array[i] is byte[][])
                {
                    byte[][] bytes = (byte[][])array[i];
                    HashSize(hasher, bytes.Length);
                    Hash(hasher, bytes);
                }
                else
                {
                    throw new ArgumentException("i=" + i);
                }
            }    	
        }