I have found my answer using a couple of different threads on this forum. Links in the code.
The main code:
string encoded = Convert.ToBase64String(StringToByteArray(sha256_hash(myString)));
Methods to support this:
// https://stackoverflow.com/a/321404
public static byte[] StringToByteArray(string hex)
{
return Enumerable.Range(0, hex.Length)
.Where(x => x % 2 == 0)
.Select(x => Convert.ToByte(hex.Substring(x, 2), 16))
.ToArray();
}
// https://stackoverflow.com/a/17001289/16241628
public static string sha256_hash(String value)
{
StringBuilder Sb = new StringBuilder();
using (SHA256 hash = SHA256Managed.Create())
{
Encoding enc = Encoding.UTF8;
Byte[] result = hash.ComputeHash(enc.GetBytes(value));
foreach (Byte b in result)
Sb.Append(b.ToString("x2"));
}
return Sb.ToString();
}