I’m moving one of my libraries to Xamarin PLC.
The official documentation states that System.Security.Cryptography namespace is supported, but it is not in actual code.
I’m looking for a way to compute SHA256 hash without this namespace (And without HashAlgorithmProvider in Windows namespace. This method breaks application for Android and WP8.0)
Test something like this using Bouncy Castle PCL lib (https://www.nuget.org/packages/Portable.BouncyCastle/)
var encData = Encoding.UTF8.GetBytes("TESTHASH");
Org.BouncyCastle.Crypto.Digests.Sha256Digest myHash = new Org.BouncyCastle.Crypto.Digests.Sha256Digest();
myHash.BlockUpdate (encData, 0, encData.Length);
byte[] compArr = new byte[myHash.GetDigestSize ()];
myHash.DoFinal (compArr, 0);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With