简体   繁体   中英

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

在C ++ WinRT中,C#方法SHA512CryptoServiceProvider.ComputeHash()的等价物是什么?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM