How do I perform a SHA512 hash in C++ WinRT?

What is the equivalent of the C# method SHA512CryptoServiceProvider.ComputeHash() in C++ WinRT?

Answers


See Windows.Security.Cryptography.Core.CryptographicHash and friends. There is an example on that page demonstrating one usage, and the documentation for related classes and functions have examples as well.

For a "complete" example, you can take a look at the compute_sha1_hash function from my Boost-licensed CxxReflect library. It computes an SHA1 hash; computing an SHA512 hash should simply require changing the requested hash algorithm from "SHA1" to "SHA512". Note that this function is written using WRL, not C++/CX, though converting the code to C++/CX should be straightforward and would result in much more succinct code.


Need Your Help

Regex stringByReplacingMatchesInString

objective-c regex cocoa nsregularexpression

I'm trying to remove any non-alphanumeric character within a string. I tried the following code snippet, but it is not replacing the appropriate character.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.