C# Class CASCExplorer.Salsa20

Implements the Salsa20 stream encryption cipher, as defined at http://cr.yp.to/snuffle.html.
Inheritance: System.Security.Cryptography.SymmetricAlgorithm
Show file Open project: WoW-Tools/CASCExplorer

Public Methods

Method Description
CreateDecryptor ( byte rgbKey, byte rgbIV ) : ICryptoTransform

Creates a symmetric decryptor object with the specified SymmetricAlgorithm.Key property and initialization vector (SymmetricAlgorithm.IV).

CreateEncryptor ( byte rgbKey, byte rgbIV ) : ICryptoTransform

Creates a symmetric encryptor object with the specified SymmetricAlgorithm.Key property and initialization vector (SymmetricAlgorithm.IV).

GenerateIV ( ) : void

Generates a random initialization vector (SymmetricAlgorithm.IV) to use for the algorithm.

GenerateKey ( ) : void

Generates a random key (SymmetricAlgorithm.Key) to use for the algorithm.

Salsa20 ( ) : System

Initializes a new instance of the Salsa20 class.

Private Methods

Method Description
CheckValidIV ( byte iv, string paramName ) : void
GetRandomBytes ( int byteCount ) : byte[]
ValidKeySize ( int size ) : bool

Method Details

CreateDecryptor() public method

Creates a symmetric decryptor object with the specified SymmetricAlgorithm.Key property and initialization vector (SymmetricAlgorithm.IV).
public CreateDecryptor ( byte rgbKey, byte rgbIV ) : ICryptoTransform
rgbKey byte The secret key to use for the symmetric algorithm.
rgbIV byte The initialization vector to use for the symmetric algorithm.
return ICryptoTransform

CreateEncryptor() public method

Creates a symmetric encryptor object with the specified SymmetricAlgorithm.Key property and initialization vector (SymmetricAlgorithm.IV).
public CreateEncryptor ( byte rgbKey, byte rgbIV ) : ICryptoTransform
rgbKey byte The secret key to use for the symmetric algorithm.
rgbIV byte The initialization vector to use for the symmetric algorithm.
return ICryptoTransform

GenerateIV() public method

Generates a random initialization vector (SymmetricAlgorithm.IV) to use for the algorithm.
public GenerateIV ( ) : void
return void

GenerateKey() public method

Generates a random key (SymmetricAlgorithm.Key) to use for the algorithm.
public GenerateKey ( ) : void
return void

Salsa20() public method

Initializes a new instance of the Salsa20 class.
The implementation of the class derived from the symmetric algorithm is not valid.
public Salsa20 ( ) : System
return System