Skip to content

Instantly share code, notes, and snippets.

@nishanc
Created August 6, 2023 12:20
Show Gist options
  • Save nishanc/e939b02b38afa4b89fcb97fadeb6e83c to your computer and use it in GitHub Desktop.
Save nishanc/e939b02b38afa4b89fcb97fadeb6e83c to your computer and use it in GitHub Desktop.
// Hashing example
if (SHA3_256.IsSupported)
{
byte[] hash = SHA3_256.HashData(dataToHash);
}
else
{
// ...
}
// Signing example
if (SHA3_256.IsSupported)
{
using ECDsa ec = ECDsa.Create(ECCurve.NamedCurves.nistP256);
byte[] signature = ec.SignData(dataToBeSigned, HashAlgorithmName.SHA3_256);
}
else
{
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment