SHA256CryptoServiceProvider error

I’m trying to create a SHA256 hash of a string using C# but i get this error in the console:

The type or namespace name `SHA256CryptoServiceProvider’ could not be found. Are you missing a using directive or an assembly reference?

I do have using System.Security.Cryptography;

This is the function:

public static string SHA256Hash(string text)
	SHA256 sha256 = new SHA256CryptoServiceProvider();	
	byte[] result = sha256.Hash;		
	StringBuilder strBuilder = new StringBuilder();
	for (int i = 0; i < result.Length; i++)
  •   }		*
  •   return strBuilder.ToString();*
  • }*
    Before i was using MD5 whitout any error, i only changed the algorithm…

I fixed this error by changing the settings in project settings>player>other settings to use api compatibility .NET 2.0. It was previously set to .Net 2.0 subset

Thanks for help