Encryption Methods
7z Format Encryption
The 7z format uses AES-256 encryption with SHA-256 key derivation:- Method ID:
06 F1 07 01(7zAES) - Key derivation: SHA-256 based
- Key length: 256 bits
- Encryption: AES-256 in CBC mode
- Authentication: Encrypted headers with CRC
ZIP Format Encryption
ZIP archives support two encryption methods:-
ZipCrypto (legacy, weak)
- Traditional ZIP encryption
- Not recommended for sensitive data
-
AES-256 (recommended)
- Method ID:
04 01 63(wzAES) - AES encryption with HMAC-SHA1 authentication
- Method ID:
Creating Encrypted Archives
Encrypt file names (7z only)
Use This prevents anyone from seeing file names without the password.
-mhe=on to encrypt file names in the archive headers:Extracting Encrypted Archives
Password Requirements
Best Practices
- Minimum length: 12+ characters
- Complexity: Mix uppercase, lowercase, numbers, and symbols
- Avoid: Dictionary words, personal information, common patterns
Password Strength Examples
| Strength | Example | Crack Time |
|---|---|---|
| Weak | password123 | Seconds |
| Medium | MyP@ssw0rd | Hours |
| Strong | X9$mK#pL2@vN | Years |
| Very Strong | Tr!nk3t-F1$h-P@rr0t-Z3bra | Centuries |
Header Encryption
7z Archives
Use-mhe=on to encrypt archive headers:
- File names are encrypted
- File sizes are hidden
- Directory structure is concealed
- Cannot list contents without password
Encryption Performance
AES-256 encryption has minimal performance impact:| Operation | Overhead |
|---|---|
| Compression | ~2-5% slower |
| Decompression | ~2-5% slower |
| Memory usage | +32 KB |
Advanced Encryption Options
Solid Archives with Encryption
Combine solid compression with encryption for maximum security and compression:Multi-volume Encrypted Archives
Split encrypted archives into volumes:Self-Extracting Encrypted Archives
Create encrypted SFX archives:Security Considerations
AES-256 SecurityAES-256 is considered unbreakable with current technology when used with a strong password. The weakest link is typically:
- Weak passwords - Use strong, random passwords
- Password reuse - Use unique passwords per archive
- Social engineering - Protect passwords from unauthorized access
Scripting with Encrypted Archives
Using Password Files
Environment Variables
Batch Processing
Encryption Implementation
7-Zip’s encryption is implemented in:C/Aes.c- AES algorithm (lines 1-544)C/AesOpt.c- Optimized AES with hardware accelerationC/Sha256.c- SHA-256 for key derivationCPP/7zip/Crypto/7zAes.cpp- 7z encryption wrapperCPP/7zip/Crypto/WzAes.cpp- ZIP AES encryption