public class MpqCrypto
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static int |
MPQ_HASH_FILE_KEY
The Constant MPQ_HASH_FILE_KEY.
|
static int |
MPQ_HASH_KEY2_MIX
The Constant MPQ_HASH_KEY2_MIX.
|
static int |
MPQ_HASH_NAME_A
The Constant MPQ_HASH_NAME_A.
|
static int |
MPQ_HASH_NAME_B
The Constant MPQ_HASH_NAME_B.
|
static int |
MPQ_HASH_TABLE_INDEX
The Constant MPQ_HASH_TABLE_INDEX.
|
static int |
MPQ_KEY_BLOCK_TABLE
The Constant MPQ_KEY_BLOCK_TABLE.
|
static int |
MPQ_KEY_HASH_TABLE
The Constant MPQ_KEY_HASH_TABLE.
|
| Constructor and Description |
|---|
MpqCrypto()
Instantiates a new mpq crypto.
|
| Modifier and Type | Method and Description |
|---|---|
byte[] |
decryptBlock(byte[] block,
int key)
Decrypt block.
|
byte[] |
decryptBlock(java.nio.ByteBuffer buf,
int length,
int key)
Decrypt block.
|
byte[] |
encryptMpqBlock(byte[] bytes,
int length,
int key)
Encrypt mpq block.
|
byte[] |
encryptMpqBlock(java.nio.ByteBuffer buf,
int length,
int dwKey1)
Encrypt mpq block.
|
int |
hash(java.lang.String fileName,
int hashType)
This is a port of unsigned long HashString(char *lpszFileName, unsigned
long dwHashType)
which is described in http://www.zezula.net/en/mpq/techinfo.html#hashes
The implementation there uses 'long' which is a 32 bit int on Windows, so
here we have to use int...
|
static void |
main(java.lang.String[] args)
The main method.
|
public static final int MPQ_HASH_TABLE_INDEX
public static final int MPQ_HASH_NAME_A
public static final int MPQ_HASH_NAME_B
public static final int MPQ_HASH_FILE_KEY
public static final int MPQ_HASH_KEY2_MIX
public static final int MPQ_KEY_HASH_TABLE
public static final int MPQ_KEY_BLOCK_TABLE
public int hash(java.lang.String fileName,
int hashType)
fileName - the file namehashType - the hash typepublic byte[] decryptBlock(byte[] block,
int key)
block - the blockkey - the keypublic byte[] decryptBlock(java.nio.ByteBuffer buf,
int length,
int key)
buf - the buflength - the lengthkey - the keypublic byte[] encryptMpqBlock(java.nio.ByteBuffer buf,
int length,
int dwKey1)
buf - the buflength - the lengthdwKey1 - the dw key1public static void main(java.lang.String[] args)
args - the argumentspublic byte[] encryptMpqBlock(byte[] bytes,
int length,
int key)
bytes - the byteslength - the lengthkey - the key