Exemplo n.º 1
0
        // Section 3.3.2
        // Define NTOWFv2(Passwd, User, UserDom) as HMAC_MD5(MD4(UNICODE(Passwd)), UNICODE(ConcatenationOf(Uppercase(User),
        // UserDom ) ) )
        // EndDefine
        private byte[] makeNtlm2Hash(string domain, string userName, string password)
        {
            byte[] pwHash  = new byte[DigestLength];
            byte[] pwBytes = Encoding.Unicode.GetBytes(Credentials.Password);

            Md4.Hash(pwHash, pwBytes);
            HMACMD5 hmac = new HMACMD5(pwHash);

            // strangely, user is upper case, domain is not.
            byte[] blob = Encoding.Unicode.GetBytes(String.Concat(userName.ToUpper(), domain));

            return(hmac.ComputeHash(blob));
        }
Exemplo n.º 2
0
        public void Md4_EmptyString()
        {
            var(data, expected) = TestVectors["Empty String"];

            var hash = Md4.Hash(data);

            CustomAssert.MatchArrays(hash, expected);
        }