HKDF-SHA256
HKDF-SHA256
HKDF is a key derivation function built on HMAC. It has two phases:
1) Extract: PRK = HMAC(salt, IKM) 2) Expand: OKM = HMAC(PRK, T(0) || info || 0x01) || HMAC(PRK, T(1) || info || 0x02) ...
Where T(0) is empty and output is truncated to the requested length.
Function signatures
func HKDFExtract(salt, ikm []byte) [32]byte
func HKDFExpand(prk [32]byte, info []byte, length int) []byte
Requirements
- If salt is nil or empty, use 32 zero bytes as the salt.
lengthcan be any non-negative value; return an empty slice for 0.- Use HMAC-SHA256 provided in the starter (do not import crypto/hmac).
Notes
- HKDF is used for protocol key derivation, not password hashing.
Run tests to see results
No issues detected