C# 클래스 Warcraft.MPQ.Crypto.MPQCrypt

파일 보기 프로젝트 열기: Nihlus/libwarcraft

공개 메소드들

메소드 설명
DecryptData ( byte data, uint key ) : byte[]

Decrypts the given input data. Bytes outside of an even 4-byte boundary are not decrypted, and are considered not encrypted.

DecryptSectorOffsetTable ( BinaryReader br, List &sectorOffsets, uint blockSize, uint key ) : void

Decrypts the sector offset table using rolling decryption - it starts where the input BinaryReader is, reads and decrypts offsets until the decrypted offset equals the input block size.

EncryptData ( byte data, uint key ) : byte[]

Encrypts the given input data. Bytes outside of an even 4-byte boundary are not encrypted, and are simply appended at the end of the data block.

GetFileKey ( string fileName, bool isAdjusted = false, uint blockOffset, uint fileSize ) : uint

Calculates the decryption key for a file sector.

Hash ( string inputString, HashType hashType ) : uint

Hashes an input string, given a hash type. This function is case-insensitive, and treats all input as being in ALL UPPER CASE.

VerifySectorChecksum ( byte sector, uint checksum ) : bool

Verifies the integrity of a file sector using an adler32 checksum.

비공개 메소드들

메소드 설명
InitializeEncryptionTable ( ) : void

Initializes the encryption table.

InternalEncryptDecrypt ( byte data, uint key ) : byte[]

Internal XOR function that encrypts and decrypts a block of data.

MPQCrypt ( ) : System

메소드 상세

DecryptData() 공개 정적인 메소드

Decrypts the given input data. Bytes outside of an even 4-byte boundary are not decrypted, and are considered not encrypted.
public static DecryptData ( byte data, uint key ) : byte[]
data byte Data to be decrypted.
key uint The decryption key to use.
리턴 byte[]

DecryptSectorOffsetTable() 공개 정적인 메소드

Decrypts the sector offset table using rolling decryption - it starts where the input BinaryReader is, reads and decrypts offsets until the decrypted offset equals the input block size.
public static DecryptSectorOffsetTable ( BinaryReader br, List &sectorOffsets, uint blockSize, uint key ) : void
br System.IO.BinaryReader The archive's BinaryReader
sectorOffsets List The output sector offsets.
blockSize uint The size of the block to be decrypted.
key uint The decryption key for the offset table.
리턴 void

EncryptData() 공개 정적인 메소드

Encrypts the given input data. Bytes outside of an even 4-byte boundary are not encrypted, and are simply appended at the end of the data block.
public static EncryptData ( byte data, uint key ) : byte[]
data byte Data to be encrypted.
key uint The encryption key to use.
리턴 byte[]

GetFileKey() 공개 정적인 메소드

Calculates the decryption key for a file sector.
public static GetFileKey ( string fileName, bool isAdjusted = false, uint blockOffset, uint fileSize ) : uint
fileName string The name of the file the sector belongs to
isAdjusted bool If set to true, the key is adjusted by the given block offset and file size.
blockOffset uint The block offset of the file.
fileSize uint The size of the file.
리턴 uint

Hash() 공개 정적인 메소드

Hashes an input string, given a hash type. This function is case-insensitive, and treats all input as being in ALL UPPER CASE.
public static Hash ( string inputString, HashType hashType ) : uint
inputString string Input string.
hashType HashType Hash type.
리턴 uint

VerifySectorChecksum() 공개 정적인 메소드

Verifies the integrity of a file sector using an adler32 checksum.
public static VerifySectorChecksum ( byte sector, uint checksum ) : bool
sector byte Sector data.
checksum uint Sector checksum.
리턴 bool