~/bend-docscommunity

src/crypto/kdf.bend checks

raw source on the hub · import 0xd9a2fae439ac7ff9e21e0853948f94fe/src/crypto/kdf.bend as Kdf

2 imports
import Base
import ./mac.bend as MAC

Types

type KdfError source · line 17 · raw

Data

Definitions

def max_length source · line 20 · raw

Nat

def extract source · line 23 · raw

@+salt:List<&2, U32> -> @ikm:List<&2, U32> -> List<&2, U32>

def blocks source · line 29 · raw

@rem:Nat -> @+prk:List<&2, U32> -> @+info:List<&2, U32> -> @prev:List<&2, U32> -> @+ctr:U32 -> List<&2, U32>

The blocks T(i), T(i+1), ... cut to rem bytes: prev is T(i-1) and ctr the counter byte i. Generation stops as soon as rem bytes are out, and no block count is computed.

def expand_if source · line 39 · raw

@+prk:List<&2, U32> -> @+info:List<&2, U32> -> @+len:Nat -> @ok:Bool -> Result<&2, &2, KdfError, List<&2, U32>>

def expand source · line 46 · raw

@+prk:List<&2, U32> -> @+info:List<&2, U32> -> @+len:Nat -> Result<&2, &2, KdfError, List<&2, U32>>

def hkdf source · line 49 · raw

@+salt:List<&2, U32> -> @ikm:List<&2, U32> -> @+info:List<&2, U32> -> @+len:Nat -> Result<&2, &2, KdfError, List<&2, U32>>