<s>
The	O
Yarrow	B-Algorithm
algorithm	I-Algorithm
is	O
a	O
family	O
of	O
cryptographic	B-Algorithm
pseudorandom	I-Algorithm
number	I-Algorithm
generators	I-Algorithm
(	O
CPRNG	B-Algorithm
)	O
devised	O
by	O
John	O
Kelsey	O
,	O
Bruce	O
Schneier	O
,	O
and	O
Niels	O
Ferguson	O
and	O
published	O
in	O
1999	O
.	O
</s>
<s>
The	O
Yarrow	B-Algorithm
algorithm	I-Algorithm
is	O
explicitly	O
unpatented	O
,	O
royalty-free	O
,	O
and	O
open	O
source	O
;	O
no	O
license	O
is	O
required	O
to	O
use	O
it	O
.	O
</s>
<s>
Yarrow	O
was	O
used	O
in	O
FreeBSD	B-Operating_System
,	O
but	O
is	O
now	O
superseded	O
by	O
Fortuna	B-Algorithm
.	O
</s>
<s>
Yarrow	O
was	O
also	O
incorporated	O
in	O
iOS	O
and	O
macOS	B-Application
for	O
their	O
/dev/random	B-Application
devices	O
,	O
but	O
Apple	O
has	O
switched	O
to	O
Fortuna	B-Algorithm
since	O
2020	O
Q1	O
.	O
</s>
<s>
The	O
design	O
of	O
Yarrow	O
consists	O
of	O
four	O
major	O
components	O
:	O
an	O
entropy	B-Algorithm
accumulator	O
,	O
a	O
reseed	B-Algorithm
mechanism	O
,	O
a	O
generation	O
mechanism	O
,	O
and	O
reseed	B-Algorithm
control	O
.	O
</s>
<s>
Yarrow	O
accumulates	O
entropy	B-Algorithm
into	O
two	O
pools	O
:	O
the	O
fast	O
pool	O
,	O
which	O
provides	O
frequent	O
reseeds	O
of	O
the	O
key	B-Application
to	O
keep	O
the	O
duration	O
of	O
key	B-Application
compromises	O
as	O
short	O
as	O
possible	O
;	O
the	O
slow	O
pool	O
,	O
which	O
provides	O
rare	O
but	O
conservative	O
reseeds	O
of	O
the	O
key	B-Application
.	O
</s>
<s>
This	O
makes	O
sure	O
that	O
the	O
reseed	B-Algorithm
is	O
secured	O
even	O
when	O
the	O
entropy	B-Algorithm
estimates	O
are	O
very	O
optimistic	O
.	O
</s>
<s>
The	O
reseed	B-Algorithm
mechanism	O
connects	O
the	O
entropy	B-Algorithm
accumulator	O
to	O
the	O
generating	O
mechanism	O
.	O
</s>
<s>
Reseeding	O
from	O
the	O
fast	O
pool	O
uses	O
the	O
current	O
key	B-Application
and	O
the	O
hash	B-Algorithm
of	O
all	O
inputs	O
to	O
the	O
fast	O
pool	O
since	O
startup	O
to	O
generate	O
a	O
new	O
key	B-Application
;	O
reseeding	O
from	O
the	O
slow	O
pool	O
behaves	O
similarly	O
,	O
except	O
it	O
also	O
uses	O
the	O
hash	B-Algorithm
of	O
all	O
inputs	O
to	O
the	O
slow	O
pool	O
to	O
generate	O
a	O
new	O
key	B-Application
.	O
</s>
<s>
Both	O
of	O
the	O
reseedings	O
reset	O
the	O
entropy	B-Algorithm
estimation	O
of	O
the	O
fast	O
pool	O
to	O
zero	O
,	O
but	O
the	O
last	O
one	O
also	O
sets	O
the	O
estimation	O
of	O
the	O
slow	O
pool	O
to	O
zero	O
.	O
</s>
<s>
The	O
reseeding	O
mechanism	O
updates	O
the	O
key	B-Application
constantly	O
,	O
so	O
that	O
even	O
if	O
the	O
key	B-Application
of	O
pool	O
information	O
is	O
known	O
to	O
the	O
attacker	O
before	O
the	O
reseed	B-Algorithm
,	O
they	O
will	O
be	O
unknown	O
to	O
the	O
attacker	O
after	O
the	O
reseed	B-Algorithm
.	O
</s>
<s>
The	O
reseed	B-Algorithm
control	O
component	O
is	O
leveraging	O
between	O
frequent	O
reseeding	O
,	O
which	O
is	O
desirable	O
but	O
might	O
allow	O
iterative	O
guessing	O
attacks	O
,	O
and	O
infrequent	O
reseeding	O
,	O
which	O
compromises	O
more	O
information	O
for	O
an	O
attacker	O
who	O
has	O
the	O
key	B-Application
.	O
</s>
<s>
Yarrow	O
uses	O
the	O
fast	O
pool	O
to	O
reseed	B-Algorithm
whenever	O
the	O
source	O
passes	O
some	O
threshold	O
values	O
,	O
and	O
uses	O
the	O
slow	O
pool	O
to	O
reseed	B-Algorithm
whenever	O
at	O
least	O
two	O
of	O
its	O
sources	O
pass	O
some	O
other	O
threshold	O
value	O
.	O
</s>
<s>
Yarrow	O
assumes	O
that	O
enough	O
entropy	B-Algorithm
can	O
be	O
accumulated	O
to	O
ensure	O
that	O
the	O
PRNG	O
is	O
in	O
an	O
unpredictable	O
state	O
.	O
</s>
<s>
The	O
designers	O
accumulate	O
entropy	B-Algorithm
in	O
the	O
purpose	O
of	O
keeping	O
the	O
ability	O
to	O
recover	O
the	O
PRNG	O
even	O
when	O
the	O
key	B-Application
is	O
compromised	O
.	O
</s>
<s>
The	O
Yarrow	O
uses	O
two	O
important	O
algorithms	O
:	O
a	O
one-way	B-Algorithm
hash	I-Algorithm
function	I-Algorithm
and	O
a	O
block	O
cipher	O
.	O
</s>
<s>
Yarrow-160	O
uses	O
three-key	O
Triple	B-Algorithm
DES	I-Algorithm
in	O
counter	O
mode	O
to	O
generate	O
outputs	O
.	O
</s>
<s>
is	O
an	O
n-bit	O
counter	O
value	O
;	O
is	O
the	O
key	B-Application
.	O
</s>
<s>
Yarrow	O
keeps	O
count	O
of	O
the	O
output	O
block	O
,	O
because	O
once	O
the	O
key	B-Application
is	O
compromised	O
,	O
the	O
leak	O
of	O
the	O
old	O
output	O
before	O
the	O
compromised	O
one	O
can	O
be	O
stopped	O
immediately	O
.	O
</s>
<s>
Once	O
some	O
system	O
security	O
parameter	O
is	O
reached	O
,	O
the	O
algorithm	O
will	O
generate	O
bits	O
of	O
PRNG	O
output	O
and	O
use	O
them	O
as	O
the	O
new	O
key	B-Application
.	O
</s>
<s>
The	O
reseed	B-Algorithm
mechanism	O
of	O
Yarrow-160	O
uses	O
SHA-1	B-Algorithm
and	O
Triple	B-Algorithm
DES	I-Algorithm
as	O
the	O
hash	B-Algorithm
function	I-Algorithm
and	O
block	O
cipher	O
.	O
</s>
<s>
Yarrow-160	O
has	O
been	O
implemented	O
in	O
Java	B-Language
,	O
and	O
for	O
FreeBSD	B-Operating_System
.	O
</s>
<s>
The	O
examples	O
can	O
be	O
found	O
in	O
"	O
An	O
implementation	O
of	O
the	O
Yarrow	O
PRNG	O
for	O
FreeBSD	B-Operating_System
"	O
by	O
Mark	O
R	O
.	O
V	O
.	O
Murray	O
.	O
</s>
<s>
The	O
entropy	B-Algorithm
estimation	O
of	O
Yarrow	O
is	O
very	O
conservative	O
,	O
thus	O
preventing	O
exhaustive	O
search	O
attacks	O
.	O
</s>
<s>
It	O
is	O
very	O
common	O
that	O
PRNGs	O
fail	O
in	O
real-world	O
applications	O
due	O
to	O
entropy	B-Algorithm
overestimation	O
and	O
guessable	O
starting	O
points	O
.	O
</s>
<s>
The	O
reseeding	O
process	O
of	O
Yarrow	O
is	O
relatively	O
computationally	O
expensive	O
,	O
thus	O
the	O
cost	O
of	O
attempting	O
to	O
guess	O
the	O
PRNG	O
's	O
key	B-Application
is	O
higher	O
.	O
</s>
<s>
Yarrow	O
uses	O
cryptographic	B-Algorithm
hash	I-Algorithm
functions	I-Algorithm
to	O
process	O
input	O
samples	O
,	O
and	O
then	O
uses	O
a	O
secure	O
update	O
function	O
to	O
combine	O
the	O
samples	O
with	O
the	O
existing	O
key	B-Application
.	O
</s>
<s>
Unlike	O
ANSI	O
X9.17	O
PRNG	O
,	O
Yarrow	O
has	O
the	O
ability	O
to	O
recover	O
from	O
a	O
key	B-Application
compromise	O
.	O
</s>
<s>
This	O
means	O
that	O
even	O
when	O
the	O
key	B-Application
is	O
compromised	O
,	O
the	O
attacker	O
will	O
not	O
be	O
able	O
to	O
predict	O
future	O
outputs	O
forever	O
.	O
</s>
<s>
Yarrow	O
has	O
the	O
entropy	B-Algorithm
samples	O
pool	O
separated	O
from	O
the	O
key	B-Application
,	O
and	O
only	O
reseeds	O
the	O
key	B-Application
when	O
the	O
entropy	B-Algorithm
pool	O
content	O
is	O
completely	O
unpredictable	O
.	O
</s>
<s>
This	O
design	O
prevents	O
iterative	O
guessing	O
attacks	O
,	O
where	O
an	O
attacker	O
with	O
the	O
key	B-Application
guesses	O
the	O
next	O
sample	O
and	O
checks	O
the	O
result	O
by	O
observing	O
the	O
next	O
output	O
.	O
</s>
<s>
Yarrow	O
depends	O
on	O
SHA-1	B-Algorithm
,	O
a	O
hash	B-Algorithm
that	O
has	O
been	O
broken	O
since	O
Yarrow	O
's	O
publication	O
and	O
is	O
no	O
longer	O
secure	O
.	O
</s>
<s>
This	O
problem	O
cannot	O
be	O
solved	O
by	O
increasing	O
entropy	B-Algorithm
accumulation	O
.	O
</s>
<s>
Yarrow	O
requires	O
entropy	B-Algorithm
estimation	O
,	O
which	O
is	O
a	O
very	O
big	O
challenge	O
for	O
implementations	O
.	O
</s>
<s>
It	O
is	O
hard	O
to	O
be	O
sure	O
how	O
much	O
entropy	B-Algorithm
to	O
collect	O
before	O
using	O
it	O
to	O
reseed	B-Algorithm
the	O
PRNG	O
.	O
</s>
<s>
This	O
problem	O
is	O
solved	O
by	O
Fortuna	B-Algorithm
(	O
PRNG	O
)	O
,	O
an	O
improvement	O
of	O
Yarrow	O
.	O
</s>
<s>
Fortuna	B-Algorithm
has	O
32	O
pools	O
to	O
collect	O
entropy	B-Algorithm
and	O
removed	O
the	O
entropy	B-Algorithm
estimator	O
completely	O
.	O
</s>
<s>
Yarrow	O
's	O
strength	O
is	O
limited	O
by	O
the	O
size	O
of	O
the	O
key	B-Application
.	O
</s>
<s>
For	O
example	O
,	O
Yarrow-160	O
has	O
an	O
effective	O
key	B-Application
size	O
of	O
160	O
bits	O
.	O
</s>
