private void CreateInitialState()
 {
     ulong[] array = (ulong[])SkeinEngine.INITIAL_STATES[SkeinEngine.VariantIdentifier(this.BlockSize, this.OutputSize)];
     if (this.key == null && array != null)
     {
         this.chain = Arrays.Clone(array);
     }
     else
     {
         this.chain = new ulong[this.BlockSize / 8];
         if (this.key != null)
         {
             this.UbiComplete(0, this.key);
         }
         this.UbiComplete(4, new SkeinEngine.Configuration((long)(this.outputSizeBytes * 8)).Bytes);
     }
     if (this.preMessageParameters != null)
     {
         for (int i = 0; i < this.preMessageParameters.Length; i++)
         {
             SkeinEngine.Parameter parameter = this.preMessageParameters[i];
             this.UbiComplete(parameter.Type, parameter.Value);
         }
     }
     this.initialState = Arrays.Clone(this.chain);
 }
        public int DoFinal(byte[] outBytes, int outOff)
        {
            this.CheckInitialised();
            if (outBytes.Length < outOff + this.outputSizeBytes)
            {
                throw new DataLengthException("Output buffer is too short to hold output of " + this.outputSizeBytes + " bytes");
            }
            this.UbiFinal();
            if (this.postMessageParameters != null)
            {
                for (int i = 0; i < this.postMessageParameters.Length; i++)
                {
                    SkeinEngine.Parameter parameter = this.postMessageParameters[i];
                    this.UbiComplete(parameter.Type, parameter.Value);
                }
            }
            int blockSize = this.BlockSize;
            int num       = (this.outputSizeBytes + blockSize - 1) / blockSize;

            for (int j = 0; j < num; j++)
            {
                int outputBytes = Math.Min(blockSize, this.outputSizeBytes - j * blockSize);
                this.Output((ulong)((long)j), outBytes, outOff + j * blockSize, outputBytes);
            }
            this.Reset();
            return(this.outputSizeBytes);
        }
 private static SkeinEngine.Parameter[] Clone(SkeinEngine.Parameter[] data, SkeinEngine.Parameter[] existing)
 {
     if (data == null)
     {
         return(null);
     }
     if (existing == null || existing.Length != data.Length)
     {
         existing = new SkeinEngine.Parameter[data.Length];
     }
     Array.Copy(data, 0, existing, 0, existing.Length);
     return(existing);
 }