Esempio n. 1
0
        public void DisposeTest()
        {
            var c = new Digest();

            c.Dispose();
            Assert.Throws <ObjectDisposedException>(() => c.Process(new byte[0]));
            Assert.Throws <ObjectDisposedException>(() => c.Compute());
        }
Esempio n. 2
0
        public byte[] Process(byte[] data)
        {
            var d = new Data(data);

            var digest = new Digest();

            var buffer = new uint[16];

            for (var i = 0; i < d.BlockCount; i++)
            {
                var index = i * 64;

                for (var a = 0; a < 64; a++, index++)
                {
                    var bufferIndex = (a / 4);
                    buffer[bufferIndex] = ((uint)((index < d.Size) ? d.DataArr[index] : d.Padding[index - d.Size]) << 24) | (buffer[(bufferIndex)] >> 8);
                }

                digest.Process(buffer);
            }

            return(digest.GetHash());
        }