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

风流意气都作罢 提交于 2019-12-11 18:12:38

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/12355417/how-do-i-perform-a-sha512-hash-in-c-winrt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!