You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/shrincs_spec/content/5-functions-and-addresses.tex
+15-11Lines changed: 15 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -7,30 +7,34 @@ \subsection{Hash Function}
7
7
\texttt{H(m) = SHA-256(m)[0:n]}
8
8
\end{center}
9
9
10
-
\subsection{Tweakable Hash Function}
11
-
To prevent multi-target attacks and ensure domain separation between the various components, we employ the tweakable hash function construction defined in SPHINCS+ \cite{sphincsplus_paper2019}:
10
+
\paragraph{SHA-256 Block Precomputation}
11
+
For SHA-256, the compression function \texttt{C(H,M)} operates on 64-byte blocks. Since \texttt{PK.seed} is 16 bytes, we pad it to 64 bytes to enable precomputation of the first block:
12
12
13
13
\begin{center}
14
-
\texttt{Tw(PK.seed, ADRS, m) = H(PK.seed || ADRS || m)}
14
+
\texttt{P = C(IV, PK.seed || 0\string^48)}
15
15
\end{center}
16
16
17
-
This usage of tweaked hashing is critical. It ensures that a hash computed at one position in the Merkle tree cannot be substituted for a hash at another position, effectively mitigating generic tree-grafting attacks.
17
+
Then we use the following precomputation \texttt{P} in the next compression function iteration.
18
+
Every function that uses SHA-256 with it's argument involving PK.seed will use this precomputation value. This optimization allows to reduce the number of hashing operation, which leads to faster computation, especially in the grinding parts of the SHRINCS.
18
19
19
-
\paragraph{Note:} For SHA-256, the compression function operates on 64-byte blocks. Since \texttt{PK.seed} is 16 bytes, we pad it to 64 bytes to enable precomputation:
20
+
Additionally, we will denote the concatenation \texttt{PK.seed || 0\string^48} as \texttt{PK.seed*}.
21
+
22
+
\subsection{Tweakable Hash Function}
23
+
To prevent multi-target attacks and ensure domain separation between the various components, we employ the tweakable hash function construction defined in SPHINCS+ \cite{sphincsplus_paper2019}:
20
24
21
25
\begin{center}
22
-
\texttt{Tw(PK.seed, ADRS, m) = H(PK.seed || 0\string^48|| ADRS || m)}
26
+
\texttt{Tw(PK.seed, ADRS, m) = H(PK.seed* || ADRS || m)}
23
27
\end{center}
24
28
25
-
Having the first 64 bytes constant (\texttt{PK.seed || 0\string^48}), we can precompute the compression function state once per key pair. Each tweak call then only needs to process the variable part (\texttt{ADRS || m}), reducing per-call overhead.
29
+
This usage of tweaked hashing is critical. It ensures that a hash computed at one position in the Merkle tree cannot be substituted for a hash at another position, effectively mitigating generic tree-grafting attacks.
26
30
27
31
\subsection{Pseudorandom Functions}
28
32
SHRINCS uses two pseudorandom functions for different purposes: key derivation and getting the randomizer for the signature.
29
33
30
34
For deterministic derivation of secret key material (WOTS+C chain starting values, FORS secret keys):
FORS+C always signs user messages (never tree roots), so it uses a simpler single-phase approach. The grinding counter is not included in the message hash. Instead, it is iterated inside \texttt{PRF\_msg\_ctr} (Section~5.3) to produce a fresh \texttt{R} on each grinding attempt. The verifier only sees the final \texttt{R}:
75
79
\begin{center}
76
-
\texttt{H\_msg\_fors(ADRS, R, PK.seed, PK.root, m) = SHA-256(ADRS || R || PK.seed || PK.root || m)[0:roundup((k*a + hsl) / 8)]}
80
+
\texttt{H\_msg\_fors(ADRS, R, PK.seed, PK.root, m) = SHA-256(PK.seed* || ADRS || R || PK.root || m)[0:roundup((k*a + hsl) / 8)]}
77
81
\end{center}
78
82
79
83
The output length is roundup((k*a + hsl) / 8) = 20 bytes for both parameter sets, encoding both the \texttt{k} FORS leaf indices and the \texttt{hsl} hypertree path indices in a unified digest (see Section~10.5).
0 commit comments