.NET Samples - How To: Cryptography

This section includes the following samples:

hash Sample

fileencrypt Sample

hash Sample

This sample shows how to generate and compare hash values System.Security.Cryptography.

Namespaces used in this sample:

System; System.Security; System.Security.Cryptography; System.IO

Classes used in this sample:

String; Hash; Console; Convert; Array; MD5; BitConverter; MD5CryptoServiceProvider; CryptoConfig; Service; HashAlgorithm

fileencrypt Sample

This sample shows how to use a CryptoStream to encrypt a file using the DES algorithm.

Namespaces used in this sample:

System; System.Security.Cryptography; System.IO; System.Security

Classes used in this sample:

Stream; File; CryptoStream; Console; DES; FileStream; String; Array; Convert; DESCryptoServiceProvider; Service; StreamReader