<s>
HKDF	B-Algorithm
is	O
a	O
simple	O
key	B-Algorithm
derivation	I-Algorithm
function	I-Algorithm
(	O
KDF	O
)	O
based	O
on	O
the	O
HMAC	B-Algorithm
message	B-Algorithm
authentication	I-Algorithm
code	I-Algorithm
.	O
</s>
<s>
The	O
main	O
approach	O
HKDF	B-Algorithm
follows	O
is	O
the	O
"	O
extract-then-expand	O
"	O
paradigm	O
,	O
where	O
the	O
KDF	O
logically	O
consists	O
of	O
two	O
modules	O
:	O
the	O
first	O
stage	O
takes	O
the	O
input	O
keying	O
material	O
and	O
"	O
extracts	O
"	O
from	O
it	O
a	O
fixed-length	O
pseudorandom	O
key	O
,	O
and	O
then	O
the	O
second	O
stage	O
"	O
expands	O
"	O
this	O
key	O
into	O
several	O
additional	O
pseudorandom	O
keys	O
(	O
the	O
output	O
of	O
the	O
KDF	O
)	O
.	O
</s>
<s>
It	O
can	O
be	O
used	O
,	O
for	O
example	O
,	O
to	O
convert	O
shared	O
secrets	O
exchanged	O
via	O
Diffie	B-Protocol
–	I-Protocol
Hellman	I-Protocol
into	O
key	O
material	O
suitable	O
for	O
use	O
in	O
encryption	O
,	O
integrity	O
checking	O
or	O
authentication	O
.	O
</s>
<s>
NIST	O
SP800-56Cr2	O
specifies	O
a	O
parameterizable	O
extract-then-expand	O
scheme	O
,	O
noting	O
that	O
RFC5869	O
HKDF	B-Algorithm
is	O
a	O
version	O
of	O
it	O
and	O
citing	O
its	O
paper	O
for	O
the	O
rationale	O
for	O
the	O
recommendations	O
 '	O
extract-and-expand	O
mechanisms	O
.	O
</s>
<s>
There	O
are	O
implementations	O
of	O
HKDF	B-Algorithm
for	O
C#	B-Application
,	O
Go	B-Application
,	O
Java	B-Language
,	O
JavaScript	B-Language
,	O
Perl	B-Language
,	O
PHP	B-Application
,	O
Python	B-Language
,	O
Ruby	B-Language
,	O
and	O
other	O
programming	O
languages	O
.	O
</s>
<s>
HKDF-Extract	O
takes	O
"	O
input	O
key	O
material	O
"	O
(	O
IKM	O
)	O
such	O
as	O
a	O
shared	O
secret	O
generated	O
using	O
Diffie-Hellman	B-Protocol
,	O
and	O
an	O
optional	O
salt	O
,	O
and	O
generates	O
a	O
cryptographic	O
key	O
called	O
the	O
PRK	O
(	O
"	O
pseudorandom	O
key	O
"	O
)	O
.	O
</s>
<s>
HKDF-Extract	O
is	O
the	O
output	O
of	O
HMAC	B-Algorithm
with	O
the	O
"	O
salt	O
"	O
as	O
the	O
key	O
and	O
the	O
"	O
IKM	O
"	O
as	O
the	O
message	O
.	O
</s>
<s>
HKDF-Expand	O
takes	O
the	O
PRK	O
,	O
some	O
"	O
info	O
"	O
,	O
and	O
a	O
length	O
,	O
and	O
generates	O
output	O
of	O
the	O
desired	O
length	O
.	O
</s>
<s>
HKDF-Expand	O
acts	O
as	O
a	O
pseudorandom	O
function	O
keyed	O
on	O
PRK	O
.	O
</s>
<s>
HKDF-Expand	O
works	O
by	O
repeatedly	O
calling	O
HMAC	B-Algorithm
using	O
the	O
PRK	O
as	O
the	O
key	O
and	O
the	O
"	O
info	O
"	O
field	O
as	O
the	O
message	O
.	O
</s>
<s>
The	O
HMAC	B-Algorithm
inputs	O
are	O
chained	O
by	O
prepending	O
the	O
previous	O
hash	O
block	O
to	O
the	O
"	O
info	O
"	O
field	O
and	O
appending	O
with	O
an	O
incrementing	O
8-bit	O
counter	O
.	O
</s>
