Beispiel #1
0
            public void Update(byte[] value, int offset, int len, ulong[] output)
            {
                int num = 0;

                while (len > num)
                {
                    if (currentOffset == currentBlock.Length)
                    {
                        ProcessBlock(output);
                        tweak.First   = false;
                        currentOffset = 0;
                    }
                    int num2 = Math.Min(len - num, currentBlock.Length - currentOffset);
                    global::System.Array.Copy((global::System.Array)value, offset + num, (global::System.Array)currentBlock, currentOffset, num2);
                    num           += num2;
                    currentOffset += num2;
                    tweak.AdvancePosition(num2);
                }
            }
Beispiel #2
0
            public void Update(byte[] value, int offset, int len, ulong[] output)
            {
                /*
                 * Buffer complete blocks for the underlying Threefish cipher, only flushing when there
                 * are subsequent bytes (last block must be processed in doFinal() with final=true set).
                 */
                int copied = 0;

                while (len > copied)
                {
                    if (currentOffset == currentBlock.Length)
                    {
                        ProcessBlock(output);
                        tweak.First   = false;
                        currentOffset = 0;
                    }

                    int toCopy = System.Math.Min((len - copied), currentBlock.Length - currentOffset);
                    Array.Copy(value, offset + copied, currentBlock, currentOffset, toCopy);
                    copied        += toCopy;
                    currentOffset += toCopy;
                    tweak.AdvancePosition(toCopy);
                }
            }