System.Security.Cryptography.IncrementalHash.AppendData C# (CSharp) Method

AppendData() public method

Append count bytes of data, starting at offset, to the data already processed in the hash or HMAC.
is null. /// is out of range. This parameter requires a non-negative number. /// /// is out of range. This parameter requires a non-negative number less than /// the value of . /// /// is greater than /// . - . /// The object has already been disposed.
public AppendData ( byte data, int offset, int count ) : void
data byte The data to process.
offset int The offset into the byte array from which to begin using data.
count int The number of bytes in the array to use as data.
return void
        public void AppendData(byte[] data, int offset, int count)
        {
            if (data == null)
                throw new ArgumentNullException(nameof(data));
            if (offset < 0)
                throw new ArgumentOutOfRangeException(nameof(offset), SR.ArgumentOutOfRange_NeedNonNegNum);
            if (count < 0 || (count > data.Length))
                throw new ArgumentOutOfRangeException(nameof(count));
            if ((data.Length - count) < offset)
                throw new ArgumentException(SR.Argument_InvalidOffLen);
            if (_disposed)
                throw new ObjectDisposedException(typeof(IncrementalHash).Name);

            Debug.Assert(_hash != null);

            if (_resetPending)
            {
                _hash.Initialize();
                _resetPending = false;
            }

            _hash.TransformBlock(data, offset, count, null, 0);
        }

Same methods

IncrementalHash::AppendData ( byte data ) : void

Usage Example

        private static void Extract(HashAlgorithmName hashAlgorithmName, int hashLength, ReadOnlySpan <byte> ikm, ReadOnlySpan <byte> salt, Span <byte> prk)
        {
            Debug.Assert(HashLength(hashAlgorithmName) == hashLength);

            using (IncrementalHash hmac = IncrementalHash.CreateHMAC(hashAlgorithmName, salt))
            {
                hmac.AppendData(ikm);
                GetHashAndReset(hmac, prk);
            }
        }
All Usage Examples Of System.Security.Cryptography.IncrementalHash::AppendData