using namespace Windows::Security::Cryptography;
using namespace Windows::Security::Cryptography::Core;
using namespace Windows::Storage::Streams;
// Convert the message string to binary data.
Platform::String ^ hashAlg= HashAlgorithmNames::Sha512;
Platform::String ^ strMsg= "mustache";
IBuffer ^ buffUtf8Msg = CryptographicBuffer::ConvertStringToBinary( strMsg, BinaryStringEncoding::Utf8 );
// Create a HashAlgorithmProvider object.
HashAlgorithmProvider ^ objAlgProv = HashAlgorithmProvider::OpenAlgorithm( hashAlg );
// Demonstrate how to retrieve the name of the hashing algorithm.
String ^ strAlgNameUsed = objAlgProv->AlgorithmName;
// Hash the message.
IBuffer ^ buffHash = objAlgProv->HashData(buffUtf8Msg);
// Convert the hash to a string (for display).
String ^ strHashBase64 = CryptographicBuffer::EncodeToBase64String(buffHash);
TextBlockStream->Text += strHashBase64;
The above is a translation of
http://msdn.microsoft.com/en-us/library/windows/apps/windows.security.cryptography.core.hashalgorithmprovider.aspx#Y205 into C++/CX.