AdventureWorks.WebServices.Tests.Controllers.IdentityControllerFixture.CreatePasswordHash C# (CSharp) Method

CreatePasswordHash() private static method

private static CreatePasswordHash ( string password, string challengeString ) : string
password string
challengeString string
return string
        private static string CreatePasswordHash(string password, string challengeString)
        {
            var passwordBuffer = Encoding.UTF8.GetBytes(password);

            // same as MacAlgorithmProvider.OpenAlgorithm(MacAlgorithmNames.HmacSha512).CreateKey(passwordBuffer) in Windows Runtime.
            var provider = new HMACSHA512(passwordBuffer);

            // Same as CryptographicBuffer.DecodeFromHexString in Windows Runtime.
            var challengeBuffer = DecodeFromHexString(challengeString);

            // same as CryptographicEngine.Sign(provider, challengeBuffer) in Windows Runtime.
            var hmacBytes = provider.ComputeHash(challengeBuffer);

            // Same as CryptographicBuffer.EncodeToHexString in Windows Runtime.
            return EncodeToHexString(hmacBytes);
        }
        #endregion