ngdp-crypto
Encryption and decryption support for Blizzard's NGDP/TACT system.
Installation
Add this to your Cargo.toml:
[]
= "0.3"
Overview
This crate provides cryptographic functionality for handling encrypted content in Blizzard's games. It implements the specific cipher configurations and key management required for TACT (Trusted Application Content Transfer) files.
Features
- Salsa20 Stream Cipher: Modern encryption used in recent WoW versions
- ARC4 (RC4) Cipher: Legacy encryption for older content
- Key Management: Automatic loading and management of encryption keys
- Multiple Key Sources: File-based, environment variables, and hardcoded keys
- Format Support: CSV, TXT, and TSV key file formats
Usage
Basic Decryption
use ;
// Initialize key service
let mut key_service = new;
key_service.load_from_standard_dirs?;
// Get a key by name
let key_name = 0xFA505078126ACB3E_u64;
if let Some = key_service.get_key
Key File Management
The KeyService automatically searches for key files in:
~/.config/cascette/~/.tactkeys/- Path specified in
CASCETTE_KEYS_PATHenvironment variable
Supported key file formats:
# CSV Format (WoW.txt style)
FA505078126ACB3E,BDC51862ABED79B2DE48C8E7E66C6200
# TXT Format with description
FA505078126ACB3E BDC51862ABED79B2DE48C8E7E66C6200 WoW 8.2.0.30898 Nazjatar Cinematic
# TSV Format
FA505078126ACB3E BDC51862ABED79B2DE48C8E7E66C6200
Cipher Details
Salsa20
- Uses 16-byte keys extended to 32 bytes (by duplication)
- 4-byte IV extended to 8 bytes (by duplication)
- Block index XORed with first 4 bytes of IV
- Compatible with WoW's BLTE encryption
ARC4/RC4
- Combines key (16 bytes) + IV (4 bytes) + block_index (4 bytes)
- Padded to 32 bytes with zeros
- Used for legacy content
Key Sources
The crate includes hardcoded keys for common WoW content and can load additional keys from:
- TACTKeys Repository: Community-maintained key database
- Local Files: User-provided key files
- Built-in Keys: Common keys hardcoded in the library
Examples
Loading Keys from File
use KeyService;
use Path;
let mut key_service = new;
let keys_loaded = key_service.load_key_file?;
println!;
Decrypting BLTE Blocks
use ;
// For Salsa20 encrypted blocks
let decrypted = decrypt_salsa20?;
// For ARC4 encrypted blocks
let decrypted = decrypt_arc4?;
Performance
- Zero-copy operations where possible
- Efficient key lookups using HashMap
- Minimal allocations during decryption
License
MIT OR Apache-2.0