Cryptographic/scrypt library
🔐 Scrypt Key Derivation Function Implementation
A production-ready implementation of the scrypt key derivation function used in Litecoin and other cryptocurrency systems. This implementation provides secure key derivation with configurable memory and time costs for defense against hardware attacks.
Features:
- RFC 7914 compliant scrypt implementation
- Configurable N (CPU/memory cost), r (block size), p (parallelization)
- Optimized for performance with minimal memory allocation
- Comprehensive error handling and validation
- Thread-safe implementation suitable for concurrent environments
- Produces configurable length output (typically 32 bytes for Litecoin)
Time complexity: O(N * r * p) where N, r, p are the scrypt parameters Space complexity: O(N * r) memory usage
Example:
final key = Scrypt.deriveKey('password', 'salt', N: 16384, r: 8, p: 1, dkLen: 32);
print(key); // 64-character hex string
Classes
- Scrypt
- Scrypt key derivation function implementation