Example #1
0
        /// <summary>
        /// Calculates SHA-512 hash value for the given bytes array.
        /// </summary>
        /// <param name="data">Data bytes array</param>
        /// <param name="index">Offset of byte sequence</param>
        /// <param name="length">Sequence length</param>
        /// <returns>Hash bytes</returns>
        public static byte[] Hash(byte[] data, int index, int length)
        {
            Contract.Requires<ArgumentNullException>(data != null);
            Contract.Requires<ArgumentOutOfRangeException>(index >= 0 && length >= 0);
            Contract.Requires<ArgumentException>((index + length) <= data.Length);

            var hasher = new Sha512();
            hasher.Update(data, index, length);
            return hasher.Finalize();
        }
Example #2
0
 public static byte[] Hash(byte[] data, int offset, int count)
 {
     var hasher = new Sha512();
     hasher.Update(data, offset, count);
     return hasher.Finish();
 }
Example #3
0
 public static byte[] Hash(byte[] data, int offset, int count)
 {
     var hasher = new Sha512();
     hasher.Update(data, offset, count);
     return hasher.Finish();
 }