HashAlgorithmProvider
is provided in Windows.Security.Cryptography.Core
, which allows developer to compute SHA1 values of byte arrays.
First at all, we need to make reference to Windows.Security.Cryptography.Core
using Windows.Security.Cryptography.Core;
Then, create a reusable cryptography hash with the opened the SHA1 algorithm and assign it to a variable.
var hash = HashAlgorithmProvider.OpenAlgorithm(HashAlgorithmNames.Sha1).CreateHash();
Get the buffer of the byte array needs to be computed and append it to the hash you created just now.
hash.Append(bytes.AsBuffer());
Now, the hash contains the SHA1 data of the specified array. If you want, you can convert the hash into byte array using the following line of codes:
hash.GetValueAndReset().ToArray();