C# Class Renci.SshNet.Security.Cryptography.Ciphers.SerpentCipher

Implements Serpent cipher algorithm.
Inheritance: BlockCipher
Mostra file Open project: sshnet/SSH.NET Class Usage Examples

Public Methods

Method Description
DecryptBlock ( byte inputBuffer, int inputOffset, int inputCount, byte outputBuffer, int outputOffset ) : int

Decrypts the specified region of the input byte array and copies the decrypted data to the specified region of the output byte array.

EncryptBlock ( byte inputBuffer, int inputOffset, int inputCount, byte outputBuffer, int outputOffset ) : int

Encrypts the specified region of the input byte array and copies the encrypted data to the specified region of the output byte array.

SerpentCipher ( byte key, CipherMode mode, CipherPadding padding ) : System

Initializes a new instance of the SerpentCipher class.

Private Methods

Method Description
BytesToWord ( byte src, int srcOff ) : int
Ib0 ( int a, int b, int c, int d ) : void

InvSO - {13, 3,11, 0,10, 6, 5,12, 1,14, 4, 7,15, 9, 8, 2 } - 15 terms.

Ib1 ( int a, int b, int c, int d ) : void

InvS1 - { 5, 8, 2,14,15, 6,12, 3,11, 4, 7, 9, 1,13,10, 0 } - 14 steps.

Ib2 ( int a, int b, int c, int d ) : void

InvS2 - {12, 9,15, 4,11,14, 1, 2, 0, 3, 6,13, 5, 8,10, 7 } - 16 steps.

Ib3 ( int a, int b, int c, int d ) : void

InvS3 - { 0, 9,10, 7,11,14, 6,13, 3, 5,12, 2, 4, 8,15, 1 } - 15 terms

Ib4 ( int a, int b, int c, int d ) : void

InvS4 - { 5, 0, 8, 3,10, 9, 7,14, 2,12,11, 6, 4,15,13, 1 } - 15 terms.

Ib5 ( int a, int b, int c, int d ) : void

InvS5 - { 8,15, 2, 9, 4, 1,13,14,11, 6, 5, 3, 7,12,10, 0 } - 16 terms.

Ib6 ( int a, int b, int c, int d ) : void

InvS6 - {15,10, 1,13, 5, 3, 6, 0, 4, 9,14, 7, 2,12, 8,11 } - 15 terms.

Ib7 ( int a, int b, int c, int d ) : void

InvS7 - { 3, 0, 6,13, 9,14,15, 8, 5,12,11, 7,10, 1, 4, 2 } - 17 terms.

InverseLT ( ) : void

Apply the inverse of the linear transformation to the register set.

LT ( ) : void

Apply the linear transformation to the register set.

MakeWorkingKey ( byte key ) : int[]

Expand a user-supplied key material into a session key.

RotateLeft ( int x, int bits ) : int
RotateRight ( int x, int bits ) : int
Sb0 ( int a, int b, int c, int d ) : void

S0 - { 3, 8,15, 1,10, 6, 5,11,14,13, 4, 2, 7, 0, 9,12 } - 15 terms.

Sb1 ( int a, int b, int c, int d ) : void

S1 - {15,12, 2, 7, 9, 0, 5,10, 1,11,14, 8, 6,13, 3, 4 } - 14 terms.

Sb2 ( int a, int b, int c, int d ) : void

S2 - { 8, 6, 7, 9, 3,12,10,15,13, 1,14, 4, 0,11, 5, 2 } - 16 terms.

Sb3 ( int a, int b, int c, int d ) : void

S3 - { 0,15,11, 8,12, 9, 6, 3,13, 1, 2, 4,10, 7, 5,14 } - 16 terms.

Sb4 ( int a, int b, int c, int d ) : void

S4 - { 1,15, 8, 3,12, 0,11, 6, 2, 5, 4,10, 9,14, 7,13 } - 15 terms.

Sb5 ( int a, int b, int c, int d ) : void

S5 - {15, 5, 2,11, 4,10, 9,12, 0, 3,14, 8,13, 6, 7, 1 } - 16 terms.

Sb6 ( int a, int b, int c, int d ) : void

S6 - { 7, 2,12, 5, 8, 4, 6,11,14, 9, 1,15,13, 3,10, 0 } - 15 terms.

Sb7 ( int a, int b, int c, int d ) : void

S7 - { 1,13,15, 0,14, 8, 2,11, 7, 4,12,10, 9, 3, 5, 6 } - 16 terms.

WordToBytes ( int word, byte dst, int dstOff ) : void

Method Details

DecryptBlock() public method

Decrypts the specified region of the input byte array and copies the decrypted data to the specified region of the output byte array.
public DecryptBlock ( byte inputBuffer, int inputOffset, int inputCount, byte outputBuffer, int outputOffset ) : int
inputBuffer byte The input data to decrypt.
inputOffset int The offset into the input byte array from which to begin using data.
inputCount int The number of bytes in the input byte array to use as data.
outputBuffer byte The output to which to write decrypted data.
outputOffset int The offset into the output byte array from which to begin writing data.
return int

EncryptBlock() public method

Encrypts the specified region of the input byte array and copies the encrypted data to the specified region of the output byte array.
public EncryptBlock ( byte inputBuffer, int inputOffset, int inputCount, byte outputBuffer, int outputOffset ) : int
inputBuffer byte The input data to encrypt.
inputOffset int The offset into the input byte array from which to begin using data.
inputCount int The number of bytes in the input byte array to use as data.
outputBuffer byte The output to which to write encrypted data.
outputOffset int The offset into the output byte array from which to begin writing data.
return int

SerpentCipher() public method

Initializes a new instance of the SerpentCipher class.
is null. Keysize is not valid for this algorithm.
public SerpentCipher ( byte key, CipherMode mode, CipherPadding padding ) : System
key byte The key.
mode CipherMode The mode.
padding CipherPadding The padding.
return System