C# Class CryptSharp.Crypter

Show file Open project: ChrisMcKee/cryptsharp

Public Methods

Method Description
Crypt ( byte key ) : string
Crypt ( byte key, string salt ) : string
GenerateSalt ( ) : string
GenerateSalt ( int rounds ) : string
PadKeyForCrypt ( byte key, bool &padded ) : byte[]
PadKeyThenCrypt ( byte key ) : string
PadKeyThenCrypt ( byte key, string salt ) : string
SafeEquals ( string a, string b ) : bool

Checks if two strings are equal. Compares every char to prevent timing attacks.

Protected Methods

Method Description
CheckKey ( byte key ) : void
GenerateSaltBytes ( int saltLength ) : byte[]

Private Methods

Method Description
Crypter ( ) : System

Method Details

CheckKey() protected method

protected CheckKey ( byte key ) : void
key byte
return void

Crypt() public method

public Crypt ( byte key ) : string
key byte
return string

Crypt() public abstract method

public abstract Crypt ( byte key, string salt ) : string
key byte
salt string
return string

GenerateSalt() public abstract method

public abstract GenerateSalt ( ) : string
return string

GenerateSalt() public abstract method

public abstract GenerateSalt ( int rounds ) : string
rounds int
return string

GenerateSaltBytes() protected static method

protected static GenerateSaltBytes ( int saltLength ) : byte[]
saltLength int
return byte[]

PadKeyForCrypt() public method

public PadKeyForCrypt ( byte key, bool &padded ) : byte[]
key byte
padded bool
return byte[]

PadKeyThenCrypt() public method

public PadKeyThenCrypt ( byte key ) : string
key byte
return string

PadKeyThenCrypt() public method

public PadKeyThenCrypt ( byte key, string salt ) : string
key byte
salt string
return string

SafeEquals() public static method

Checks if two strings are equal. Compares every char to prevent timing attacks.
public static SafeEquals ( string a, string b ) : bool
a string String to compare.
b string String to compare.
return bool