Documentation
¶
Overview ¶
Package hbedf provides functionality for generating derived seeds from initial biographic information and a secret.
Index ¶
- func Expand(h func() hash.Hash, pbm []byte, key *hdsk.HDKey, length int) ([]byte, error)
- func Extract(h func() hash.Hash, ibm [][]byte, key *hdsk.HDKey, c, mem int) ([][]byte, int, error)
- func Key(h func() hash.Hash, secret []byte, schema, path string) (*hdsk.HDKey, error)
- func New(h func() hash.Hash, ibm [][]byte, secret []byte, opts Opts) ([]byte, error)
- func Shuffle(h func() hash.Hash, sbm [][]byte, key *hdsk.HDKey, N int) ([]byte, error)
- type Opts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Expand ¶
Expand generates output seed material (osm) from pseudorandom biographic material (pbm) by repeatedly applying HMAC to expand the pbm, from a given hash, pbm slice, pointer to an HD key, and output length.
func Extract ¶
Extract extracts strengthened biographic material (sbm) from initial biographic material (ibm), and calculates a scrypt N parameter, from a given hash, ibm slice, pointer to an HD key, iterations count, and target memory cost. The sbm and N produced are suitable for use in the Shuffle phase.
func Key ¶
Key derives a node in a hierarchy and returns a pointer to an HD key, from a given hash, secret, schema, and derivation path. The HD key derived is suitable for use in the Extract, Shuffle, and Expand phases.
func New ¶
New generates a derived seed from initial biographic material (ibm) and a secret, from a given hash, ibm slice, secret, and options.
For example, you can obtain a derived seed by doing:
ds, err := hbedf.New(h, ibm, secret, opts)
From the options, Path and Schema are a derivation path and schema. A default schema is used when an empty string ("") is provided. C is the HMAC iterations count for strengthening. Mem is the target memory cost for scrypt. DsLen is the output byte length of the derived seed.
func Shuffle ¶
Shuffle takes strengthened biographic material (sbm) and shuffles it across two iterations of a Fisher-Yates shuffle to produce pseudorandom biographic material (pbm), from a given hash, sbm slice, pointer to an HD key, and scrypt N parameter. The pbm produced is suitable for use in the Expand phase.