protected byte[] ComputeHash(byte[] value, int offset, int count)
        {
            if (null == value)
            {
                throw new ArgumentNullException(nameof(value));
            }

            if (offset < 0 || offset > value.Length)
            {
                throw new ArgumentOutOfRangeException(nameof(offset));
            }

            if (count < 0 || offset + count > value.Length)
            {
                throw new ArgumentOutOfRangeException(nameof(count));
            }

            byte[] hash;

            using (MD4 md4 = new MD4Managed())
            {
                md4.Initialize();
                hash = md4.ComputeHash(value, offset, count);
            }

            return(hash);
        }
Esempio n. 2
0
        private byte[] ComputeHash(string value, int offset, int count)
        {
            byte[] hash;

            using (MD4 md4 = new MD4Managed())
            {
                md4.Initialize();
                hash = md4.ComputeHash(MessageEncoding.GetBytes(value), offset, count);
            }

            return(hash);
        }