Do these two code blocks return the same thing? Assume arr
is the same byte[]
in both examples:
Code sample 1
HashAlgorithm a = HashAlgorithm.Create("SHA-256");
var result = a.ComputeHash(arr);
Code sample 2
SHA256 b = SHA256.Create();
var result = b.ComputeHash(arr);
UPDATE:
I got the sample project of creating AWS signature code in C# (which is written in .Net 4.5) and am trying to use its classes in a dotnetcode5 project and just because HashAlgorithm.Create()
is not available in dotnetcode5 yet, I have decided to use the second approach instead of the first one. The problem is that the second example returns a canonical result witch is not valid in AWS.