def cr.pbkdf2.out

bend-osdev-crypto@0.1.0.0 · pbkdf2.bend:65

import bend-osdev-crypto@0.1.0.0/pbkdf2.bend as Pbkdf2
import Base
import bend-osdev-bytes@0.1.0.0/bytes.bend as B

65# n more bytes: the rest of the current block cur, then T_(i+1), T_(i+2), ...
66# (a MAC whose tags are empty gives zeros)
67def cr.pbkdf2.out(~K: Data, ~compute: K -> B.Octets -> B.Octets, n: Nat, cur: List<&2, U32>, +k: K, +salt: B.Octets, +c: Nat, +i: U32) -> List<&2, U32>:
68  match n:
69    case 0n:
70      Nil{}
71    case 1n+p:
72      match cur:
73        case Con{h, t}:
74          Con{h, cr.pbkdf2.out(~K, ~compute, p, t, k, salt, c, i)}
75        case Nil{}:
76          +blk = cr.pbkdf2.block(~K, ~compute, k, salt, c, U32.add(i, 1))
77          Con{cr.pbkdf2.head(blk), cr.pbkdf2.out(~K, ~compute, p, cr.pbkdf2.tail(blk), k, salt, c, U32.add(i, 1))}

Uses (8)

Used by (5)