SHA-3 (Secure Hash Algorithm 3)
SHA-3 is the latest member of the Secure Hash Algorithm family, standardized by NIST in 2015 (FIPS 202). It is based on the Keccak algorithm.Supported Variants
| Algorithm | Output Size | Default Enabled | Platform Support |
|---|---|---|---|
| SHA3-224 | 224 bits (28 bytes) | No (insecure) | QAT 1.8+, QAT 2.0, qatlib |
| SHA3-256 | 256 bits (32 bytes) | No (experimental) | QAT 1.8+, QAT 2.0, qatlib |
| SHA3-384 | 384 bits (48 bytes) | No (experimental) | QAT 1.8+, QAT 2.0, qatlib |
| SHA3-512 | 512 bits (64 bytes) | No (experimental) | QAT 1.8+, QAT 2.0, qatlib |
Platform Availability
- QAT 1.7: Not supported
- QAT 1.8+: All SHA-3 variants available (disabled by default)
- QAT 2.0: All SHA-3 variants available (disabled by default)
- qatlib: All SHA-3 variants available (disabled by default)
Configuration
SHA-3 algorithms are experimental and disabled by default. To enable:- Build QAT Engine with appropriate flags
- Configure via environment variables or configuration file
Usage with OpenSSL EVP API
Computing a SHA3-256 Hash
Computing SHA3-512 Hash
Incremental Hashing
SHA-3 supports incremental hashing for large data:One-Shot Hashing
For small data, use the convenience function:SM3
SM3 is a cryptographic hash function published as a Chinese National Standard (GM/T 0004-2012).Supported Variants
| Algorithm | Output Size | Default Enabled | Platform Support |
|---|---|---|---|
| SM3 | 256 bits (32 bytes) | No (experimental) | QAT 1.8+, QAT 2.0 |
Platform Availability
- QAT 1.7: Not supported
- QAT 1.8+: Available (disabled by default, experimental)
- QAT 2.0: Available (disabled by default, experimental)
- qatlib: Not available
Configuration
SM3 is experimental and disabled by default. Enable through build configuration.Usage with OpenSSL EVP API
General Hash Operations
Copying Hash Context
You can copy a hash context to compute hashes of related data:HMAC with SHA-3
Combine SHA-3 with HMAC for message authentication:Performance Considerations
When to Use Hardware Acceleration
Hardware acceleration provides benefits when:- Hashing large amounts of data (> 4KB)
- High-throughput scenarios with many concurrent hash operations
- Server workloads processing many requests
Optimal Usage Patterns
- Batch Processing: Process multiple messages to amortize setup costs
- Large Buffers: Use larger buffer sizes (8KB-64KB) for EVP_DigestUpdate
- Asynchronous Mode: Enable async operations for better throughput
Performance Tuning
Software Fallback
Hash operations automatically fall back to OpenSSL software implementation when:- QAT hardware is unavailable
- Algorithm is disabled or unsupported
- Request queue is full
- Small data sizes (below hardware threshold)
Error Handling
Proper error handling is essential:Use Cases
SHA-3
- Digital signatures: Input to signature algorithms
- Data integrity: Verify file or message integrity
- Password hashing: As part of password-based key derivation
- Blockchain: Cryptographic operations in distributed ledgers
- Certificate generation: Hash inputs for X.509 certificates
SM3
- Chinese cryptographic standards: Required for compliance
- SM2 digital signatures: Used with SM2 elliptic curve algorithm
- Government applications: Mandated by Chinese regulations
- Financial services: Banking and payment systems in China
Algorithm Characteristics
SHA-3 Family
| Variant | Output Size | Block Size | Security Level |
|---|---|---|---|
| SHA3-224 | 224 bits | 1152 bits | 112 bits |
| SHA3-256 | 256 bits | 1088 bits | 128 bits |
| SHA3-384 | 384 bits | 832 bits | 192 bits |
| SHA3-512 | 512 bits | 576 bits | 256 bits |
SM3
| Property | Value |
|---|---|
| Output Size | 256 bits |
| Block Size | 512 bits |
| Security Level | 128 bits |
| Standard | GM/T 0004-2012 |