Documentation
¶
Index ¶
Constants ¶
const (
ErrInvalid = Error("invalid value")
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HMAC ¶
type HMAC struct {
// contains filtered or unexported fields
}
HMAC is a deterministic HMAC-DRBG (NIST SP800-90A). It produces reproducible output for a given seed — used both for deterministic derivations (KDFs, ratchets, protocol-instance UIDs) and, wrapped in a Service, as the periodically-reseeded process entropy source.
func NewHMAC ¶
the NIST Document specify a nonce, XXX TODO: check seed sizes and fail initialization if not enough..
type PRNG ¶
type PRNG interface {
// equivalent to .bytes(l) -> r
io.Reader
// BigInt(n)
Int(n *big.Int) (a *big.Int, err error)
}
this is the abstract type in the spec :)
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is the process entropy source: a thread-safe HMAC-DRBG that periodically reseeds itself from the OS CSPRNG for prediction resistance (reference PRNGServiceHmacSHA256). Every reseedFrequency reads it mixes fresh crypto/rand entropy into the DRBG state, so a one-time state compromise cannot predict future output. Use NewHMAC directly (no reseed) where deterministic output is required — KDFs, ratchets, protocol-instance UIDs.
func NewService ¶
NewService creates a reseeding DRBG service seeded from crypto/rand, using hash h (e.g. sha256.New).