Crypto Class

Provides methods to generate hash values and encrypt passwords or other sensitive data.

Inheritance Hierarchy

System.Object
  System.Web.Helpers.Crypto

Namespace:  System.Web.Helpers
Assembly:  System.Web.Helpers (in System.Web.Helpers.dll)

Syntax

'Declaration
Public NotInheritable Class Crypto
'Usage
public static class Crypto
public ref class Crypto abstract sealed
[<AbstractClassAttribute>]
[<SealedAttribute>]
type Crypto =  class end
public final class Crypto

The Crypto type exposes the following members.

Methods

  Name Description
Public methodStatic member GenerateSalt Generates a cryptographically strong sequence of random byte values.
Public methodStatic member Hash(array<Byte[], String) Returns a hash value for the specified byte array.
Public methodStatic member Hash(String, String) Returns a hash value for the specified string.
Public methodStatic member HashPassword Returns an RFC 2898 hash value for the specified password.
Public methodStatic member SHA1 Returns a SHA-1 hash value for the specified string.
Public methodStatic member SHA256 Returns a SHA-256 hash value for the specified string.
Public methodStatic member VerifyHashedPassword Determines whether the specified RFC 2898 hash and password are a cryptographic match.

Top

Remarks

This class represents a helper, which is a component that simplifies web programming in ASP.NET Web Pages. You can use the Crypto class to encrypt passwords and other sensitive data in order to prevent the data from being read if an unauthorized party gains access to the data.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

System.Web.Helpers Namespace