C# Класс OpenStory.Cryptography.RollingIv

Represents an AES encryption transformer.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
ConstructHeader ( int length ) : byte[]

Constructs a packet header.

GetPacketLength ( byte header ) : int

Reads a packet header from an array and extracts the packet's length.

GetVersion ( byte header, byte iv ) : ushort

Extracts a version from the header using a specified IV.

RollingIv ( ICryptoAlgorithm algorithm, byte initialIv, ushort versionMask ) : System

Initializes a new instance of the RollingIv class.

Transform ( byte data ) : void

Transforms the specified data in-place.

TryGetLength ( byte header, int &length ) : bool

Attempts to extract the length of a packet from its header.

When overriding this method in a derived class, do not call the base implementation.

ValidateHeader ( byte header ) : bool

Determines whether the start of an array is a valid packet header.

Приватные методы

Метод Описание
GetVersionInternal ( byte header, byte iv ) : ushort
ValidateHeaderInternal ( byte header, byte iv, ushort versionMask ) : bool

Описание методов

ConstructHeader() публичный Метод

Constructs a packet header.
/// Thrown if is less than 2. ///
public ConstructHeader ( int length ) : byte[]
length int The length of the packet to make a header for.
Результат byte[]

GetPacketLength() публичный статический Метод

Reads a packet header from an array and extracts the packet's length.
/// Thrown if is . /// /// Thrown if has less than 4 elements. ///
public static GetPacketLength ( byte header ) : int
header byte The array to read from.
Результат int

GetVersion() публичный статический Метод

Extracts a version from the header using a specified IV.
/// Thrown if /// or are . /// /// Thrown if has less than 4 elements or /// if doesn't have exactly 4 elements. ///
public static GetVersion ( byte header, byte iv ) : ushort
header byte The header byte array.
iv byte The IV to use for the decoding.
Результат ushort

RollingIv() публичный Метод

Initializes a new instance of the RollingIv class.
/// Thrown if or is . /// /// Thrown if does not have exactly 4 elements. ///
public RollingIv ( ICryptoAlgorithm algorithm, byte initialIv, ushort versionMask ) : System
algorithm ICryptoAlgorithm The instance for this session.
initialIv byte The initial IV for this instance.
versionMask ushort The version mask used for header creation.
Результат System

Transform() публичный Метод

Transforms the specified data in-place.
Thrown if is .
public Transform ( byte data ) : void
data byte The array to transform. This array will be directly modified.
Результат void

TryGetLength() публичный Метод

Attempts to extract the length of a packet from its header.
When overriding this method in a derived class, do not call the base implementation.
/// Thrown if is . /// /// Thrown if has less than 4 elements. ///
public TryGetLength ( byte header, int &length ) : bool
header byte The header byte array to process.
length int A variable to hold the result.
Результат bool

ValidateHeader() публичный Метод

Determines whether the start of an array is a valid packet header.
public ValidateHeader ( byte header ) : bool
header byte The raw packet data to validate.
Результат bool