C# Class Microsoft.Protocols.TestTools.StackSdk.BranchCache.Pccrc.PccrcUtility

The PCCRC utility.
Datei anzeigen Open project: Microsoft/WindowsProtocolTestSuites Class Usage Examples

Public Methods

Method Description
GetHashAlgorithm ( dwHashAlgoV2_Values hashAlgo, HashAlgorithm &hashAlgorithm, HMAC &hmacAlgorithm ) : void

Get the hash algorithm and hmac algorithm for V2.

GetHashAlgorithm ( dwHashAlgo_Values hashAlgo, HashAlgorithm &hashAlgorithm, HMAC &hmacAlgorithm, int &blockHashSize ) : void

Get the hash algorithm and hmac algorithm for V1.

GetHoHoDkBytes ( byte kp, byte hod, dwHashAlgoV2_Values hashAlgo ) : byte[]

Compute the segment HoD.

GetHoHoDkBytes ( byte kp, byte hod, dwHashAlgo_Values hashAlgo ) : byte[]

Compute the segment HoD.

GetHoHoDkString ( byte kp, byte hod, dwHashAlgo_Values hashAlgo ) : string

Compute the segment HoD.

ParseContentInformation ( byte data ) : Content_Information_Data_Structure

Parse the information of the content

ParseContentInformation ( byte data, int &index ) : Content_Information_Data_Structure

Parse the information of the content

ParseContentInformationV2 ( byte data ) : Content_Information_Data_Structure_V2

Parse the information of the content

ParseContentInformationV2 ( byte data, int &index ) : Content_Information_Data_Structure_V2

Parse the information of the content

ReadFile ( string filePath ) : byte[]

Read files from assigned directory.

ToHexString ( byte data ) : string

Transfer a byte array to a hex string. Example from a byte array { 0x0a, 0x0b, 0x0c }, the return is a string 0A0B0C.

Private Methods

Method Description
GetBytes ( byte buffer, int &index, int count ) : byte[]

Get bytes from bytes.

GetDataSizeByHashAlgo ( dwHashAlgo_Values dwHashAlgo ) : int

Get data size by hash algorithm.

GetUInt16 ( byte buffer, int &index ) : ushort

Parse UInt16 from bytes.

GetUInt32 ( byte buffer, int &index ) : uint

Parse UInt32 from bytes

GetUInt64 ( byte buffer, int &index ) : ulong

Parse UInt64 from bytes.

ParseBlocks ( dwHashAlgo_Values dwHashAlgo, uint cSegments, byte data, int &index ) : Microsoft.Protocols.TestTools.StackSdk.BranchCache.Pccrc.SegmentContentBlocks[]

Parse the information of the block.

ParseSements ( dwHashAlgo_Values dwHashAlgo, uint cSegments, byte data, int &index ) : Microsoft.Protocols.TestTools.StackSdk.BranchCache.Pccrc.SegmentDescription[]

Parse the information of segment.

Method Details

GetHashAlgorithm() public static method

Get the hash algorithm and hmac algorithm for V2.
public static GetHashAlgorithm ( dwHashAlgoV2_Values hashAlgo, HashAlgorithm &hashAlgorithm, HMAC &hmacAlgorithm ) : void
hashAlgo dwHashAlgoV2_Values The hash algorithm value
hashAlgorithm System.Security.Cryptography.HashAlgorithm
hmacAlgorithm System.Security.Cryptography.HMAC
return void

GetHashAlgorithm() public static method

Get the hash algorithm and hmac algorithm for V1.
public static GetHashAlgorithm ( dwHashAlgo_Values hashAlgo, HashAlgorithm &hashAlgorithm, HMAC &hmacAlgorithm, int &blockHashSize ) : void
hashAlgo dwHashAlgo_Values The hash algorithm value
hashAlgorithm System.Security.Cryptography.HashAlgorithm
hmacAlgorithm System.Security.Cryptography.HMAC
blockHashSize int
return void

GetHoHoDkBytes() public static method

Compute the segment HoD.
public static GetHoHoDkBytes ( byte kp, byte hod, dwHashAlgoV2_Values hashAlgo ) : byte[]
kp byte The Kp data
hod byte The segment HoD
hashAlgo dwHashAlgoV2_Values The HoHoDk hash algorithm.
return byte[]

GetHoHoDkBytes() public static method

Compute the segment HoD.
public static GetHoHoDkBytes ( byte kp, byte hod, dwHashAlgo_Values hashAlgo ) : byte[]
kp byte The Kp data
hod byte The segment HoD
hashAlgo dwHashAlgo_Values The HoHoDk hash algorithm.
return byte[]

GetHoHoDkString() public static method

Compute the segment HoD.
public static GetHoHoDkString ( byte kp, byte hod, dwHashAlgo_Values hashAlgo ) : string
kp byte The Kp data
hod byte The segment HoD
hashAlgo dwHashAlgo_Values The HoHoDk hash algorithm.
return string

ParseContentInformation() public static method

Parse the information of the content
public static ParseContentInformation ( byte data ) : Content_Information_Data_Structure
data byte The byte data in little-endian order.
return Content_Information_Data_Structure

ParseContentInformation() public static method

Parse the information of the content
public static ParseContentInformation ( byte data, int &index ) : Content_Information_Data_Structure
data byte The byte data in little-endian order.
index int The start index.
return Content_Information_Data_Structure

ParseContentInformationV2() public static method

Parse the information of the content
public static ParseContentInformationV2 ( byte data ) : Content_Information_Data_Structure_V2
data byte The byte data in little-endian order.
return Content_Information_Data_Structure_V2

ParseContentInformationV2() public static method

Parse the information of the content
public static ParseContentInformationV2 ( byte data, int &index ) : Content_Information_Data_Structure_V2
data byte The byte data in little-endian order.
index int The start index.
return Content_Information_Data_Structure_V2

ReadFile() public static method

Read files from assigned directory.
public static ReadFile ( string filePath ) : byte[]
filePath string The file path.
return byte[]

ToHexString() public static method

Transfer a byte array to a hex string. Example from a byte array { 0x0a, 0x0b, 0x0c }, the return is a string 0A0B0C.
public static ToHexString ( byte data ) : string
data byte The input byte array
return string