[
[
['5','add','hl'],
['6','add','hl'],
['94','add','hl'],
['91','add','hl'],
['15','remove','slide-up'],
['2','add','slide-down']
],
[
['18','add','hl'],
['18','remove','hidden'],
['19','add','hl'],
['19','remove','hidden'],
['24','add','hl'],
['24','remove','hidden'],
['4','add','hidden'],
['5','remove','hl'],
['5','add','hidden'],
['6','remove','hl'],
['6','add','hidden'],
['94','remove','hl'],
['94','add','slide-left'],
['91','remove','hl'],
['91','add','slide-left']
],
[
['18','remove','hl'],
['19','remove','hl'],
['24','remove','hl'],
['88','add','hl'],
['28','remove','slide-up'],
['15','add','slide-down']
],
[
['33','add','hl'],
['33','remove','hidden'],
['34','add','hl'],
['34','remove','hidden'],
['8','remove','indent-1'],
['88','remove','hl'],
['88','add','slide-left'],
['8','add','indent-2']
],
[
['33','remove','hl'],
['34','remove','hl'],
['19','add','hl'],
['87','add','hl'],
['43','remove','slide-up'],
['28','add','slide-down']
],
[
['88','add','hl'],
['88','remove','slide-left'],
['19','remove','hl'],
['19','add','hidden'],
['87','remove','hl'],
['87','add','slide-right']
],
[
['88','remove','hl'],
['33','add','hl'],
['57','remove','slide-up'],
['43','add','slide-down']
],
[
['87','add','hl'],
['87','remove','slide-right'],
['61','add','hl'],
['61','remove','hidden'],
['33','remove','hl'],
['33','add','hidden']
],
[
['87','remove','hl'],
['61','remove','hl'],
['93','add','hl'],
['90','add','hl'],
['71','remove','slide-up'],
['57','add','slide-down']
],
[
['73','remove','hidden'],
['94','add','hl'],
['94','remove','slide-left'],
['91','add','hl'],
['91','remove','slide-left'],
['83','add','hl'],
['83','remove','hidden'],
['93','remove','hl'],
['93','add','slide-right'],
['90','remove','hl'],
['90','add','slide-right']
],
[
['94','remove','hl'],
['91','remove','hl'],
['83','remove','hl']
]
]
The starting point is $\lib{sym-ratch-real}$.
First, modify the library to sample $R$ lazily at the last possible moment.
Rewrite the logic of $\ratchadvance$, putting the computation of $G$ into two branches of an if-statement.
Apply the PRG security of $G$ (three-hop maneuver not shown).
The if-branch of $\ratchadvance$ samples $R$ uniformly but doesn't actually use its value. So just as before, we can leave $R$ undefined in this case; it will be sampled uniformly later when it is needed.
We can add a boolean flag ``$\textsf{compromised}$'' that is $\mytrue$ if and only if $\ratchadvance$ has been called, if and only if $R$ is defined. The result is $\lib{sym-ratch-rand}$.
$\lib{sym-ratch-real}$
$R \gets \bits^\secpar$
$\lib{sym-ratch-rand}$
if
$R$ undefined:
not $\textsf{compromised}$:
$R \gets \bits^\secpar$
$R \| \key $
${}:= G(R)$
${}\gets \bits^{2\secpar}$
$\key \gets \bits^\secpar$
else:
$R \| \key := G(R)$
return $\key$
if
$R$ undefined: $R \gets \bits^\secpar$
not $\textsf{compromised}$: $R \gets \bits^\secpar$
$\textsf{compromised} := \mytrue$
return $R$