HashAlgorithm sha = SHA256.Create(); byte[] data = Encoding.UTF8.GetBytes("test data"); byte[] hash = sha.ComputeHash(data); sha.Clear();In the above code, SHA256 hash algorithm is created and used to calculate the hash of "test data". After calculation, the internal state of the algorithm is cleared. Package Library: System.Security.Cryptography