Table of Contents

Class VersatileBufferExtensions

Namespace
VAST.Common
Assembly
VAST.Common.dll

Provides extension methods for VersatileBuffer.

public static class VersatileBufferExtensions
Inheritance
VersatileBufferExtensions
Inherited Members

Methods

Append(VersatileBuffer, string)

Appends a UTF-8 encoded string to the buffer.

public static void Append(this VersatileBuffer vb, string s)

Parameters

vb VersatileBuffer

The buffer to append to.

s string

The string to append.

ComputeHash(VersatileBuffer, HashAlgorithm, int, int)

Computes a hash of a portion of the buffer using the specified hash algorithm.

public static byte[] ComputeHash(this VersatileBuffer vb, HashAlgorithm hasher, int offset, int size)

Parameters

vb VersatileBuffer

The buffer to compute the hash from.

hasher HashAlgorithm

The hash algorithm to use.

offset int

The starting position within the buffer.

size int

The number of bytes to include in the hash computation.

Returns

byte[]

A byte array containing the computed hash.

ConvertToBase64String(VersatileBuffer, int, int)

Converts a portion of the buffer to a Base64 encoded string.

public static string ConvertToBase64String(this VersatileBuffer vb, int offset, int size)

Parameters

vb VersatileBuffer

The buffer to convert from.

offset int

The starting position within the buffer.

size int

The number of bytes to convert.

Returns

string

A Base64 encoded string representing the specified portion of the buffer.

Exceptions

ArgumentException

Thrown when the offset and size exceed the buffer size.

ConvertToString(VersatileBuffer, int, int)

Converts a portion of the buffer to a UTF-8 encoded string.

public static string ConvertToString(this VersatileBuffer vb, int offset, int size)

Parameters

vb VersatileBuffer

The buffer to convert from.

offset int

The starting position within the buffer.

size int

The number of bytes to convert.

Returns

string

A string decoded from the specified portion of the buffer using UTF-8 encoding.

Exceptions

ArgumentException

Thrown when the offset and size exceed the buffer size.

Decrypt(VersatileBuffer, IEncrypter, int, int, ref byte[], VersatileBuffer)

Decrypts a portion of the buffer using the specified encrypter.

public static void Decrypt(this VersatileBuffer vb, IEncrypter crypto, int offset, int size, ref byte[] intermediateBuffer, VersatileBuffer decryptedPacket)

Parameters

vb VersatileBuffer

The buffer containing encrypted data.

crypto IEncrypter

The encrypter to use for decryption.

offset int

The starting position of the encrypted data within the buffer.

size int

The number of bytes to decrypt.

intermediateBuffer byte[]

A reusable intermediate buffer for copying data; will be allocated or resized as needed.

decryptedPacket VersatileBuffer

The buffer to write the decrypted data to.

Encrypt(VersatileBuffer, IEncrypter, int, int, ref byte[], VersatileBuffer)

Encrypts a portion of the buffer using the specified encrypter.

public static void Encrypt(this VersatileBuffer vb, IEncrypter crypto, int offset, int size, ref byte[] intermediateBuffer, VersatileBuffer encryptedPacket)

Parameters

vb VersatileBuffer

The buffer containing data to encrypt.

crypto IEncrypter

The encrypter to use for encryption.

offset int

The starting position of the data within the buffer.

size int

The number of bytes to encrypt.

intermediateBuffer byte[]

A reusable intermediate buffer for copying data; will be allocated or resized as needed.

encryptedPacket VersatileBuffer

The buffer to write the encrypted data to.