-
Notifications
You must be signed in to change notification settings - Fork 173
/
mathspec
20 lines (15 loc) · 1016 Bytes
/
mathspec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Let siphash24 be the standard siphash-2-4 function [0]
with a 256 bit key K=<k0,k1,k2,k3> instead of the usual 128-bit one,
and a modified Initialization phase that sets v_i to k_i for 0 <= i < 4.
Set N = 2^32
Define a bipartite graph [1] G_K=(V,E) with N edges on N + N nodes as follows:
for 0 <= i < N, E_i = (V_i_0, V_i_1) = (siphash24(K,2*i) % N, siphash24(K,2*i+1) % N)
From G_K we obtain the graph G'_K by identifying nodes that differ only in the last bit:
for 0 <= i < N, E'_i = (V_i_0 >> 1, V_i_1 >> 1)
A Cuckatoo32 solution for key K is a 42-cycle [2] in G'_K that is a matching [3] in G_K.
In other words, it's a cycle on node-pairs with edges incident on both nodes in a pair.
For verification purposes, the solution is given as the sequence of 42 edge indices in increasing order.
[0] https://cr.yp.to/siphash/siphash-20120918.pdf
[1] https://en.wikipedia.org/wiki/Bipartite_graph
[2] https://en.wikipedia.org/wiki/Cycle_(graph_theory)
[3] https://en.wikipedia.org/wiki/Matching_(graph_theory)