<s>
The	O
Grain	B-Algorithm
128a	I-Algorithm
stream	B-Algorithm
cipher	I-Algorithm
was	O
first	O
purposed	O
at	O
Symmetric	O
Key	O
Encryption	O
Workshop	O
(	O
SKEW	O
)	O
in	O
2011	O
as	O
an	O
improvement	O
of	O
the	O
predecessor	O
Grain	O
128	O
,	O
which	O
added	O
security	O
enhancements	O
and	O
optional	O
message	O
authentication	O
using	O
the	O
Encrypt	O
&	O
MAC	O
approach	O
.	O
</s>
<s>
One	O
of	O
the	O
important	O
features	O
of	O
the	O
Grain	B-Algorithm
family	I-Algorithm
is	O
that	O
the	O
throughput	O
can	O
be	O
increased	O
at	O
the	O
expense	O
of	O
additional	O
hardware	O
.	O
</s>
<s>
Grain	B-Algorithm
128a	I-Algorithm
is	O
designed	O
by	O
Martin	O
Ågren	O
,	O
Martin	O
Hell	O
,	O
Thomas	O
Johansson	O
and	O
Willi	O
Meier	O
.	O
</s>
<s>
Grain	B-Algorithm
128a	I-Algorithm
consists	O
of	O
two	O
large	O
parts	O
:	O
Pre-output	O
function	O
and	O
MAC	O
.	O
</s>
<s>
The	O
pre-output	O
function	O
has	O
an	O
internal	O
state	O
size	O
of	O
256	O
bits	O
,	O
consisting	O
of	O
two	O
registers	O
of	O
size	O
128	O
bit	O
:	O
NLFSR	B-Algorithm
and	O
LFSR	B-Architecture
.	O
</s>
<s>
The	O
pre-output	O
function	O
consists	O
of	O
two	O
registers	O
of	O
size	O
128	O
bit	O
:	O
NLFSR	B-Algorithm
(	O
)	O
and	O
LFSR	B-Architecture
(	O
)	O
along	O
with	O
2	O
feedback	O
polynomials	O
and	O
and	O
a	O
boolean	O
function	O
.	O
</s>
<s>
In	O
addition	O
to	O
the	O
feedback	O
polynomials	O
,	O
the	O
update	O
functions	O
for	O
the	O
NLFSR	B-Algorithm
and	O
the	O
LFSR	B-Architecture
are	O
:	O
</s>
<s>
The	O
LFSR	B-Architecture
is	O
initialised	O
as	O
:	O
</s>
<s>
The	O
NLFSR	B-Algorithm
is	O
initialised	O
by	O
copying	O
the	O
entire	O
128	O
bit	O
key	O
(	O
)	O
into	O
the	O
NLFSR	B-Algorithm
:	O
</s>
<s>
The	O
key	O
stream	O
(	O
)	O
and	O
MAC	O
functionality	O
in	O
Grain	B-Algorithm
128a	I-Algorithm
both	O
share	O
the	O
same	O
pre-output	O
stream	O
(	O
)	O
.	O
</s>
<s>
Grain	B-Algorithm
128a	I-Algorithm
supports	O
tags	O
of	O
size	O
up	O
to	O
32	O
bit	O
,	O
to	O
do	O
this	O
2	O
registers	O
of	O
size	O
is	O
used	O
,	O
a	O
shift	O
register( )	O
and	O
an	O
accumulator( )	O
.	O
</s>
<s>
For	O
each	O
bit	O
in	O
the	O
accumulator	B-General_Concept
we	O
at	O
time	O
we	O
denounce	O
a	O
bit	O
in	O
the	O
accumulator	B-General_Concept
as	O
.	O
</s>
<s>
When	O
authentication	O
is	O
enabled	O
Grain	B-Algorithm
128a	I-Algorithm
uses	O
the	O
first	O
bits	O
of	O
the	O
pre-output	O
stream( )	O
to	O
initialise	O
the	O
shift	O
register	O
and	O
the	O
accumulator	B-General_Concept
.	O
</s>
<s>
Accumulator	B-General_Concept
:	O
</s>
<s>
Accumulator	B-General_Concept
:	O
</s>
<s>
When	O
the	O
cipher	O
has	O
completed	O
the	O
L	O
iterations	O
the	O
final	O
tag( )	O
is	O
the	O
content	O
of	O
the	O
accumulator	B-General_Concept
:	O
</s>
