-
Notifications
You must be signed in to change notification settings - Fork 1
/
spb_hash.c
696 lines (658 loc) · 45.5 KB
/
spb_hash.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
#include <sys/types.h>
#include <stdint.h>
#include <string.h>
#include <x86intrin.h>
#include "spb_hash.h"
#include "mem.h"
static const uint64_t s1 = 0x6a09e667f3bcc908ULL;
static const uint64_t s2 = 0xbb67ae8584caa73bULL;
static const uint64_t s3 = 0x3c6ef372fe94f82bULL;
static const uint64_t s4 = 0xa54ff53a5f1d36f1ULL;
static const uint64_t spb1[] = {
0x0002040000004080, 0x0002040810200000, 0x0002040800204080, 0x0002040810004080,
0x0102040800004000, 0x0002040010004080, 0x0002040010204080, 0x0102000000200080,
0x0000040800000000, 0x0000000000000080, 0x0002040000204080, 0x0000040010004080,
0x0102040810204000, 0x0102000800204080, 0x0100040010004080, 0x0002040800204000,
0x0102000010004000, 0x0100000000004000, 0x0102000010000080, 0x0002040810200080,
0x0102040810004000, 0x0002000810000080, 0x0002000000204080, 0x0102040800000000,
0x0100040010200080, 0x0102000800200000, 0x0100040000004000, 0x0100040010204080,
0x0100000810200000, 0x0100040000200000, 0x0002040800004000, 0x0102000000000000,
0x0100040800204080, 0x0102040810200080, 0x0100000800004080, 0x0000040000204000,
0x0000040800204000, 0x0000040810204080, 0x0102040800204080, 0x0102000010200000,
0x0000040800200000, 0x0100040000200080, 0x0102040000200080, 0x0102040800000080,
0x0002040800000080, 0x0102000810000000, 0x0000040800000080, 0x0000000800200080,
0x0000000000200000, 0x0102000000204080, 0x0000040000004080, 0x0102000000004080,
0x0000000810000000, 0x0100000800204000, 0x0000000000200080, 0x0100000810004000,
0x0000000000204080, 0x0000000800004000, 0x0100000000000000, 0x0102040000004000,
0x0102040010004080, 0x0000040000204080, 0x0100040800004000, 0x0002040800200080,
0x0000000010000080, 0x0100000000004080, 0x0000040010200000, 0x0000000810004000,
0x0000000810004080, 0x0002040010204000, 0x0002000810004000, 0x0100040000000000,
0x0002000800004000, 0x0000040810004080, 0x0102000800204000, 0x0100040800004080,
0x0000040010000080, 0x0102040000004080, 0x0000040010204080, 0x0100000000200000,
0x0002000800004080, 0x0102000800000080, 0x0000000000000000, 0x0102040010200080,
0x0000040000000000, 0x0102040810200000, 0x0100040800000080, 0x0002000810004080,
0x0002040010004000, 0x0102000010004080, 0x0100040810204000, 0x0000040810000080,
0x0002000010004000, 0x0002000010200000, 0x0002000810000000, 0x0102000010204080,
0x0102000800000000, 0x0102040010204080, 0x0100040010004000, 0x0102040810004080,
0x0002000000004080, 0x0002000010200080, 0x0000040800004080, 0x0100000000200080,
0x0002000000200080, 0x0102040810000080, 0x0000000000004000, 0x0002040810204080,
0x0002000800000000, 0x0000040810200000, 0x0100000810204080, 0x0100040010000000,
0x0002000800000080, 0x0100040000004080, 0x0002000000000000, 0x0100000010204080,
0x0100000800004000, 0x0100000810200080, 0x0000040810000000, 0x0102040800200080,
0x0100040810200000, 0x0100040800204000, 0x0102000810004000, 0x0000040000000080,
0x0000000800000000, 0x0102040810204080, 0x0102040800004080, 0x0102000800004000,
0x0102000010200080, 0x0000000010200000, 0x0000000800004080, 0x0102040010200000,
0x0002000810204080, 0x0100000800204080, 0x0002000000200000, 0x0000000800204080,
0x0102000000200000, 0x0100040000204080, 0x0002040810204000, 0x0000040810200080,
0x0002040000200000, 0x0002000810200080, 0x0000000810000080, 0x0002040800004080,
0x0002040000000000, 0x0100000000000080, 0x0002000010204080, 0x0102000810200000,
0x0000040000004000, 0x0000040010004000, 0x0100000800000000, 0x0100000010000000,
0x0002000000204000, 0x0102040010204000, 0x0100040810000000, 0x0000000800200000,
0x0102000810204000, 0x0002000810204000, 0x0000000010004080, 0x0102000810004080,
0x0102040000000000, 0x0000040800004000, 0x0000040810004000, 0x0000000010004000,
0x0002000010000080, 0x0000000000204000, 0x0000040000200000, 0x0002000810200000,
0x0102000000004000, 0x0102000800004080, 0x0100040010200000, 0x0002040000004000,
0x0100000800000080, 0x0100000800200080, 0x0102040000200000, 0x0002040810000080,
0x0102040000204080, 0x0102000010000000, 0x0000040800204080, 0x0002040010200080,
0x0100000010200080, 0x0102000800200080, 0x0002000010204000, 0x0100040010000080,
0x0002040010200000, 0x0002000800204000, 0x0102040800200000, 0x0102040010004000,
0x0002040000200080, 0x0002040810004000, 0x0100040010204000, 0x0000000010000000,
0x0100040810004000, 0x0002040810000000, 0x0000040000200080, 0x0000040010204000,
0x0000000810200000, 0x0100040000204000, 0x0100040800200000, 0x0102000000204000,
0x0102040010000000, 0x0102000810200080, 0x0002040800200000, 0x0000000810204080,
0x0002000010004080, 0x0100040810200080, 0x0100000010004080, 0x0100000010004000,
0x0002040800000000, 0x0000040810204000, 0x0100040800200080, 0x0002040000204000,
0x0002000010000000, 0x0000000000004080, 0x0102040800204000, 0x0000000010204000,
0x0002040000000080, 0x0000040800200080, 0x0002000800204080, 0x0100040810000080,
0x0100000000204000, 0x0102000000000080, 0x0000000810200080, 0x0100000810204000,
0x0102040000000080, 0x0102040810000000, 0x0100000810000000, 0x0000000800000080,
0x0002040010000080, 0x0102000810000080, 0x0100000010204000, 0x0100000800200000,
0x0100000810004080, 0x0000000810204000, 0x0100000000204080, 0x0102040010000080,
0x0102000010204000, 0x0002000800200080, 0x0000040010000000, 0x0102000810204080,
0x0100000010200000, 0x0100040000000080, 0x0100000010000080, 0x0000000010200080,
0x0100040810204080, 0x0102040000204000, 0x0002000000004000, 0x0002040010000000,
0x0002000000000080, 0x0100000810000080, 0x0000040010200080, 0x0000000010204080,
0x0100040800000000, 0x0002000800200000, 0x0100040810004080, 0x0000000800204000,
};
static const uint64_t spb2[] = {
0x0004080000008001, 0x0004081020400000, 0x0004081000408001, 0x0004081020008001,
0x0204081000008000, 0x0004080020008001, 0x0004080020408001, 0x0204000000400001,
0x0000081000000000, 0x0000000000000001, 0x0004080000408001, 0x0000080020008001,
0x0204081020408000, 0x0204001000408001, 0x0200080020008001, 0x0004081000408000,
0x0204000020008000, 0x0200000000008000, 0x0204000020000001, 0x0004081020400001,
0x0204081020008000, 0x0004001020000001, 0x0004000000408001, 0x0204081000000000,
0x0200080020400001, 0x0204001000400000, 0x0200080000008000, 0x0200080020408001,
0x0200001020400000, 0x0200080000400000, 0x0004081000008000, 0x0204000000000000,
0x0200081000408001, 0x0204081020400001, 0x0200001000008001, 0x0000080000408000,
0x0000081000408000, 0x0000081020408001, 0x0204081000408001, 0x0204000020400000,
0x0000081000400000, 0x0200080000400001, 0x0204080000400001, 0x0204081000000001,
0x0004081000000001, 0x0204001020000000, 0x0000081000000001, 0x0000001000400001,
0x0000000000400000, 0x0204000000408001, 0x0000080000008001, 0x0204000000008001,
0x0000001020000000, 0x0200001000408000, 0x0000000000400001, 0x0200001020008000,
0x0000000000408001, 0x0000001000008000, 0x0200000000000000, 0x0204080000008000,
0x0204080020008001, 0x0000080000408001, 0x0200081000008000, 0x0004081000400001,
0x0000000020000001, 0x0200000000008001, 0x0000080020400000, 0x0000001020008000,
0x0000001020008001, 0x0004080020408000, 0x0004001020008000, 0x0200080000000000,
0x0004001000008000, 0x0000081020008001, 0x0204001000408000, 0x0200081000008001,
0x0000080020000001, 0x0204080000008001, 0x0000080020408001, 0x0200000000400000,
0x0004001000008001, 0x0204001000000001, 0x0000000000000000, 0x0204080020400001,
0x0000080000000000, 0x0204081020400000, 0x0200081000000001, 0x0004001020008001,
0x0004080020008000, 0x0204000020008001, 0x0200081020408000, 0x0000081020000001,
0x0004000020008000, 0x0004000020400000, 0x0004001020000000, 0x0204000020408001,
0x0204001000000000, 0x0204080020408001, 0x0200080020008000, 0x0204081020008001,
0x0004000000008001, 0x0004000020400001, 0x0000081000008001, 0x0200000000400001,
0x0004000000400001, 0x0204081020000001, 0x0000000000008000, 0x0004081020408001,
0x0004001000000000, 0x0000081020400000, 0x0200001020408001, 0x0200080020000000,
0x0004001000000001, 0x0200080000008001, 0x0004000000000000, 0x0200000020408001,
0x0200001000008000, 0x0200001020400001, 0x0000081020000000, 0x0204081000400001,
0x0200081020400000, 0x0200081000408000, 0x0204001020008000, 0x0000080000000001,
0x0000001000000000, 0x0204081020408001, 0x0204081000008001, 0x0204001000008000,
0x0204000020400001, 0x0000000020400000, 0x0000001000008001, 0x0204080020400000,
0x0004001020408001, 0x0200001000408001, 0x0004000000400000, 0x0000001000408001,
0x0204000000400000, 0x0200080000408001, 0x0004081020408000, 0x0000081020400001,
0x0004080000400000, 0x0004001020400001, 0x0000001020000001, 0x0004081000008001,
0x0004080000000000, 0x0200000000000001, 0x0004000020408001, 0x0204001020400000,
0x0000080000008000, 0x0000080020008000, 0x0200001000000000, 0x0200000020000000,
0x0004000000408000, 0x0204080020408000, 0x0200081020000000, 0x0000001000400000,
0x0204001020408000, 0x0004001020408000, 0x0000000020008001, 0x0204001020008001,
0x0204080000000000, 0x0000081000008000, 0x0000081020008000, 0x0000000020008000,
0x0004000020000001, 0x0000000000408000, 0x0000080000400000, 0x0004001020400000,
0x0204000000008000, 0x0204001000008001, 0x0200080020400000, 0x0004080000008000,
0x0200001000000001, 0x0200001000400001, 0x0204080000400000, 0x0004081020000001,
0x0204080000408001, 0x0204000020000000, 0x0000081000408001, 0x0004080020400001,
0x0200000020400001, 0x0204001000400001, 0x0004000020408000, 0x0200080020000001,
0x0004080020400000, 0x0004001000408000, 0x0204081000400000, 0x0204080020008000,
0x0004080000400001, 0x0004081020008000, 0x0200080020408000, 0x0000000020000000,
0x0200081020008000, 0x0004081020000000, 0x0000080000400001, 0x0000080020408000,
0x0000001020400000, 0x0200080000408000, 0x0200081000400000, 0x0204000000408000,
0x0204080020000000, 0x0204001020400001, 0x0004081000400000, 0x0000001020408001,
0x0004000020008001, 0x0200081020400001, 0x0200000020008001, 0x0200000020008000,
0x0004081000000000, 0x0000081020408000, 0x0200081000400001, 0x0004080000408000,
0x0004000020000000, 0x0000000000008001, 0x0204081000408000, 0x0000000020408000,
0x0004080000000001, 0x0000081000400001, 0x0004001000408001, 0x0200081020000001,
0x0200000000408000, 0x0204000000000001, 0x0000001020400001, 0x0200001020408000,
0x0204080000000001, 0x0204081020000000, 0x0200001020000000, 0x0000001000000001,
0x0004080020000001, 0x0204001020000001, 0x0200000020408000, 0x0200001000400000,
0x0200001020008001, 0x0000001020408000, 0x0200000000408001, 0x0204080020000001,
0x0204000020408000, 0x0004001000400001, 0x0000080020000000, 0x0204001020408001,
0x0200000020400000, 0x0200080000000001, 0x0200000020000001, 0x0000000020400001,
0x0200081020408001, 0x0204080000408000, 0x0004000000008000, 0x0004080020000000,
0x0004000000000001, 0x0200001020000001, 0x0000080020400001, 0x0000000020408001,
0x0200081000000000, 0x0004001000400000, 0x0200081020008001, 0x0000001000408000,
};
static const uint64_t spb3[] = {
0x0008100000000102, 0x0008102040800000, 0x0008102000800102, 0x0008102040000102,
0x0408102000000100, 0x0008100040000102, 0x0008100040800102, 0x0408000000800002,
0x0000102000000000, 0x0000000000000002, 0x0008100000800102, 0x0000100040000102,
0x0408102040800100, 0x0408002000800102, 0x0400100040000102, 0x0008102000800100,
0x0408000040000100, 0x0400000000000100, 0x0408000040000002, 0x0008102040800002,
0x0408102040000100, 0x0008002040000002, 0x0008000000800102, 0x0408102000000000,
0x0400100040800002, 0x0408002000800000, 0x0400100000000100, 0x0400100040800102,
0x0400002040800000, 0x0400100000800000, 0x0008102000000100, 0x0408000000000000,
0x0400102000800102, 0x0408102040800002, 0x0400002000000102, 0x0000100000800100,
0x0000102000800100, 0x0000102040800102, 0x0408102000800102, 0x0408000040800000,
0x0000102000800000, 0x0400100000800002, 0x0408100000800002, 0x0408102000000002,
0x0008102000000002, 0x0408002040000000, 0x0000102000000002, 0x0000002000800002,
0x0000000000800000, 0x0408000000800102, 0x0000100000000102, 0x0408000000000102,
0x0000002040000000, 0x0400002000800100, 0x0000000000800002, 0x0400002040000100,
0x0000000000800102, 0x0000002000000100, 0x0400000000000000, 0x0408100000000100,
0x0408100040000102, 0x0000100000800102, 0x0400102000000100, 0x0008102000800002,
0x0000000040000002, 0x0400000000000102, 0x0000100040800000, 0x0000002040000100,
0x0000002040000102, 0x0008100040800100, 0x0008002040000100, 0x0400100000000000,
0x0008002000000100, 0x0000102040000102, 0x0408002000800100, 0x0400102000000102,
0x0000100040000002, 0x0408100000000102, 0x0000100040800102, 0x0400000000800000,
0x0008002000000102, 0x0408002000000002, 0x0000000000000000, 0x0408100040800002,
0x0000100000000000, 0x0408102040800000, 0x0400102000000002, 0x0008002040000102,
0x0008100040000100, 0x0408000040000102, 0x0400102040800100, 0x0000102040000002,
0x0008000040000100, 0x0008000040800000, 0x0008002040000000, 0x0408000040800102,
0x0408002000000000, 0x0408100040800102, 0x0400100040000100, 0x0408102040000102,
0x0008000000000102, 0x0008000040800002, 0x0000102000000102, 0x0400000000800002,
0x0008000000800002, 0x0408102040000002, 0x0000000000000100, 0x0008102040800102,
0x0008002000000000, 0x0000102040800000, 0x0400002040800102, 0x0400100040000000,
0x0008002000000002, 0x0400100000000102, 0x0008000000000000, 0x0400000040800102,
0x0400002000000100, 0x0400002040800002, 0x0000102040000000, 0x0408102000800002,
0x0400102040800000, 0x0400102000800100, 0x0408002040000100, 0x0000100000000002,
0x0000002000000000, 0x0408102040800102, 0x0408102000000102, 0x0408002000000100,
0x0408000040800002, 0x0000000040800000, 0x0000002000000102, 0x0408100040800000,
0x0008002040800102, 0x0400002000800102, 0x0008000000800000, 0x0000002000800102,
0x0408000000800000, 0x0400100000800102, 0x0008102040800100, 0x0000102040800002,
0x0008100000800000, 0x0008002040800002, 0x0000002040000002, 0x0008102000000102,
0x0008100000000000, 0x0400000000000002, 0x0008000040800102, 0x0408002040800000,
0x0000100000000100, 0x0000100040000100, 0x0400002000000000, 0x0400000040000000,
0x0008000000800100, 0x0408100040800100, 0x0400102040000000, 0x0000002000800000,
0x0408002040800100, 0x0008002040800100, 0x0000000040000102, 0x0408002040000102,
0x0408100000000000, 0x0000102000000100, 0x0000102040000100, 0x0000000040000100,
0x0008000040000002, 0x0000000000800100, 0x0000100000800000, 0x0008002040800000,
0x0408000000000100, 0x0408002000000102, 0x0400100040800000, 0x0008100000000100,
0x0400002000000002, 0x0400002000800002, 0x0408100000800000, 0x0008102040000002,
0x0408100000800102, 0x0408000040000000, 0x0000102000800102, 0x0008100040800002,
0x0400000040800002, 0x0408002000800002, 0x0008000040800100, 0x0400100040000002,
0x0008100040800000, 0x0008002000800100, 0x0408102000800000, 0x0408100040000100,
0x0008100000800002, 0x0008102040000100, 0x0400100040800100, 0x0000000040000000,
0x0400102040000100, 0x0008102040000000, 0x0000100000800002, 0x0000100040800100,
0x0000002040800000, 0x0400100000800100, 0x0400102000800000, 0x0408000000800100,
0x0408100040000000, 0x0408002040800002, 0x0008102000800000, 0x0000002040800102,
0x0008000040000102, 0x0400102040800002, 0x0400000040000102, 0x0400000040000100,
0x0008102000000000, 0x0000102040800100, 0x0400102000800002, 0x0008100000800100,
0x0008000040000000, 0x0000000000000102, 0x0408102000800100, 0x0000000040800100,
0x0008100000000002, 0x0000102000800002, 0x0008002000800102, 0x0400102040000002,
0x0400000000800100, 0x0408000000000002, 0x0000002040800002, 0x0400002040800100,
0x0408100000000002, 0x0408102040000000, 0x0400002040000000, 0x0000002000000002,
0x0008100040000002, 0x0408002040000002, 0x0400000040800100, 0x0400002000800000,
0x0400002040000102, 0x0000002040800100, 0x0400000000800102, 0x0408100040000002,
0x0408000040800100, 0x0008002000800002, 0x0000100040000000, 0x0408002040800102,
0x0400000040800000, 0x0400100000000002, 0x0400000040000002, 0x0000000040800002,
0x0400102040800102, 0x0408100000800100, 0x0008000000000100, 0x0008100040000000,
0x0008000000000002, 0x0400002040000002, 0x0000100040800002, 0x0000000040800102,
0x0400102000000000, 0x0008002000800000, 0x0400102040000102, 0x0000002000800100,
};
static const uint64_t spb4[] = {
0x0010200000000204, 0x0010204080010000, 0x0010204000010204, 0x0010204080000204,
0x0810204000000200, 0x0010200080000204, 0x0010200080010204, 0x0810000000010004,
0x0000204000000000, 0x0000000000000004, 0x0010200000010204, 0x0000200080000204,
0x0810204080010200, 0x0810004000010204, 0x0800200080000204, 0x0010204000010200,
0x0810000080000200, 0x0800000000000200, 0x0810000080000004, 0x0010204080010004,
0x0810204080000200, 0x0010004080000004, 0x0010000000010204, 0x0810204000000000,
0x0800200080010004, 0x0810004000010000, 0x0800200000000200, 0x0800200080010204,
0x0800004080010000, 0x0800200000010000, 0x0010204000000200, 0x0810000000000000,
0x0800204000010204, 0x0810204080010004, 0x0800004000000204, 0x0000200000010200,
0x0000204000010200, 0x0000204080010204, 0x0810204000010204, 0x0810000080010000,
0x0000204000010000, 0x0800200000010004, 0x0810200000010004, 0x0810204000000004,
0x0010204000000004, 0x0810004080000000, 0x0000204000000004, 0x0000004000010004,
0x0000000000010000, 0x0810000000010204, 0x0000200000000204, 0x0810000000000204,
0x0000004080000000, 0x0800004000010200, 0x0000000000010004, 0x0800004080000200,
0x0000000000010204, 0x0000004000000200, 0x0800000000000000, 0x0810200000000200,
0x0810200080000204, 0x0000200000010204, 0x0800204000000200, 0x0010204000010004,
0x0000000080000004, 0x0800000000000204, 0x0000200080010000, 0x0000004080000200,
0x0000004080000204, 0x0010200080010200, 0x0010004080000200, 0x0800200000000000,
0x0010004000000200, 0x0000204080000204, 0x0810004000010200, 0x0800204000000204,
0x0000200080000004, 0x0810200000000204, 0x0000200080010204, 0x0800000000010000,
0x0010004000000204, 0x0810004000000004, 0x0000000000000000, 0x0810200080010004,
0x0000200000000000, 0x0810204080010000, 0x0800204000000004, 0x0010004080000204,
0x0010200080000200, 0x0810000080000204, 0x0800204080010200, 0x0000204080000004,
0x0010000080000200, 0x0010000080010000, 0x0010004080000000, 0x0810000080010204,
0x0810004000000000, 0x0810200080010204, 0x0800200080000200, 0x0810204080000204,
0x0010000000000204, 0x0010000080010004, 0x0000204000000204, 0x0800000000010004,
0x0010000000010004, 0x0810204080000004, 0x0000000000000200, 0x0010204080010204,
0x0010004000000000, 0x0000204080010000, 0x0800004080010204, 0x0800200080000000,
0x0010004000000004, 0x0800200000000204, 0x0010000000000000, 0x0800000080010204,
0x0800004000000200, 0x0800004080010004, 0x0000204080000000, 0x0810204000010004,
0x0800204080010000, 0x0800204000010200, 0x0810004080000200, 0x0000200000000004,
0x0000004000000000, 0x0810204080010204, 0x0810204000000204, 0x0810004000000200,
0x0810000080010004, 0x0000000080010000, 0x0000004000000204, 0x0810200080010000,
0x0010004080010204, 0x0800004000010204, 0x0010000000010000, 0x0000004000010204,
0x0810000000010000, 0x0800200000010204, 0x0010204080010200, 0x0000204080010004,
0x0010200000010000, 0x0010004080010004, 0x0000004080000004, 0x0010204000000204,
0x0010200000000000, 0x0800000000000004, 0x0010000080010204, 0x0810004080010000,
0x0000200000000200, 0x0000200080000200, 0x0800004000000000, 0x0800000080000000,
0x0010000000010200, 0x0810200080010200, 0x0800204080000000, 0x0000004000010000,
0x0810004080010200, 0x0010004080010200, 0x0000000080000204, 0x0810004080000204,
0x0810200000000000, 0x0000204000000200, 0x0000204080000200, 0x0000000080000200,
0x0010000080000004, 0x0000000000010200, 0x0000200000010000, 0x0010004080010000,
0x0810000000000200, 0x0810004000000204, 0x0800200080010000, 0x0010200000000200,
0x0800004000000004, 0x0800004000010004, 0x0810200000010000, 0x0010204080000004,
0x0810200000010204, 0x0810000080000000, 0x0000204000010204, 0x0010200080010004,
0x0800000080010004, 0x0810004000010004, 0x0010000080010200, 0x0800200080000004,
0x0010200080010000, 0x0010004000010200, 0x0810204000010000, 0x0810200080000200,
0x0010200000010004, 0x0010204080000200, 0x0800200080010200, 0x0000000080000000,
0x0800204080000200, 0x0010204080000000, 0x0000200000010004, 0x0000200080010200,
0x0000004080010000, 0x0800200000010200, 0x0800204000010000, 0x0810000000010200,
0x0810200080000000, 0x0810004080010004, 0x0010204000010000, 0x0000004080010204,
0x0010000080000204, 0x0800204080010004, 0x0800000080000204, 0x0800000080000200,
0x0010204000000000, 0x0000204080010200, 0x0800204000010004, 0x0010200000010200,
0x0010000080000000, 0x0000000000000204, 0x0810204000010200, 0x0000000080010200,
0x0010200000000004, 0x0000204000010004, 0x0010004000010204, 0x0800204080000004,
0x0800000000010200, 0x0810000000000004, 0x0000004080010004, 0x0800004080010200,
0x0810200000000004, 0x0810204080000000, 0x0800004080000000, 0x0000004000000004,
0x0010200080000004, 0x0810004080000004, 0x0800000080010200, 0x0800004000010000,
0x0800004080000204, 0x0000004080010200, 0x0800000000010204, 0x0810200080000004,
0x0810000080010200, 0x0010004000010004, 0x0000200080000000, 0x0810004080010204,
0x0800000080010000, 0x0800200000000004, 0x0800000080000004, 0x0000000080010004,
0x0800204080010204, 0x0810200000010200, 0x0010000000000200, 0x0010200080000000,
0x0010000000000004, 0x0800004080000004, 0x0000200080010004, 0x0000000080010204,
0x0800204000000000, 0x0010004000010000, 0x0800204080000204, 0x0000004000010200,
};
static const uint64_t spb5[] = {
0x0020400000000408, 0x0020408001020000, 0x0020408000020408, 0x0020408001000408,
0x1020408000000400, 0x0020400001000408, 0x0020400001020408, 0x1020000000020008,
0x0000408000000000, 0x0000000000000008, 0x0020400000020408, 0x0000400001000408,
0x1020408001020400, 0x1020008000020408, 0x1000400001000408, 0x0020408000020400,
0x1020000001000400, 0x1000000000000400, 0x1020000001000008, 0x0020408001020008,
0x1020408001000400, 0x0020008001000008, 0x0020000000020408, 0x1020408000000000,
0x1000400001020008, 0x1020008000020000, 0x1000400000000400, 0x1000400001020408,
0x1000008001020000, 0x1000400000020000, 0x0020408000000400, 0x1020000000000000,
0x1000408000020408, 0x1020408001020008, 0x1000008000000408, 0x0000400000020400,
0x0000408000020400, 0x0000408001020408, 0x1020408000020408, 0x1020000001020000,
0x0000408000020000, 0x1000400000020008, 0x1020400000020008, 0x1020408000000008,
0x0020408000000008, 0x1020008001000000, 0x0000408000000008, 0x0000008000020008,
0x0000000000020000, 0x1020000000020408, 0x0000400000000408, 0x1020000000000408,
0x0000008001000000, 0x1000008000020400, 0x0000000000020008, 0x1000008001000400,
0x0000000000020408, 0x0000008000000400, 0x1000000000000000, 0x1020400000000400,
0x1020400001000408, 0x0000400000020408, 0x1000408000000400, 0x0020408000020008,
0x0000000001000008, 0x1000000000000408, 0x0000400001020000, 0x0000008001000400,
0x0000008001000408, 0x0020400001020400, 0x0020008001000400, 0x1000400000000000,
0x0020008000000400, 0x0000408001000408, 0x1020008000020400, 0x1000408000000408,
0x0000400001000008, 0x1020400000000408, 0x0000400001020408, 0x1000000000020000,
0x0020008000000408, 0x1020008000000008, 0x0000000000000000, 0x1020400001020008,
0x0000400000000000, 0x1020408001020000, 0x1000408000000008, 0x0020008001000408,
0x0020400001000400, 0x1020000001000408, 0x1000408001020400, 0x0000408001000008,
0x0020000001000400, 0x0020000001020000, 0x0020008001000000, 0x1020000001020408,
0x1020008000000000, 0x1020400001020408, 0x1000400001000400, 0x1020408001000408,
0x0020000000000408, 0x0020000001020008, 0x0000408000000408, 0x1000000000020008,
0x0020000000020008, 0x1020408001000008, 0x0000000000000400, 0x0020408001020408,
0x0020008000000000, 0x0000408001020000, 0x1000008001020408, 0x1000400001000000,
0x0020008000000008, 0x1000400000000408, 0x0020000000000000, 0x1000000001020408,
0x1000008000000400, 0x1000008001020008, 0x0000408001000000, 0x1020408000020008,
0x1000408001020000, 0x1000408000020400, 0x1020008001000400, 0x0000400000000008,
0x0000008000000000, 0x1020408001020408, 0x1020408000000408, 0x1020008000000400,
0x1020000001020008, 0x0000000001020000, 0x0000008000000408, 0x1020400001020000,
0x0020008001020408, 0x1000008000020408, 0x0020000000020000, 0x0000008000020408,
0x1020000000020000, 0x1000400000020408, 0x0020408001020400, 0x0000408001020008,
0x0020400000020000, 0x0020008001020008, 0x0000008001000008, 0x0020408000000408,
0x0020400000000000, 0x1000000000000008, 0x0020000001020408, 0x1020008001020000,
0x0000400000000400, 0x0000400001000400, 0x1000008000000000, 0x1000000001000000,
0x0020000000020400, 0x1020400001020400, 0x1000408001000000, 0x0000008000020000,
0x1020008001020400, 0x0020008001020400, 0x0000000001000408, 0x1020008001000408,
0x1020400000000000, 0x0000408000000400, 0x0000408001000400, 0x0000000001000400,
0x0020000001000008, 0x0000000000020400, 0x0000400000020000, 0x0020008001020000,
0x1020000000000400, 0x1020008000000408, 0x1000400001020000, 0x0020400000000400,
0x1000008000000008, 0x1000008000020008, 0x1020400000020000, 0x0020408001000008,
0x1020400000020408, 0x1020000001000000, 0x0000408000020408, 0x0020400001020008,
0x1000000001020008, 0x1020008000020008, 0x0020000001020400, 0x1000400001000008,
0x0020400001020000, 0x0020008000020400, 0x1020408000020000, 0x1020400001000400,
0x0020400000020008, 0x0020408001000400, 0x1000400001020400, 0x0000000001000000,
0x1000408001000400, 0x0020408001000000, 0x0000400000020008, 0x0000400001020400,
0x0000008001020000, 0x1000400000020400, 0x1000408000020000, 0x1020000000020400,
0x1020400001000000, 0x1020008001020008, 0x0020408000020000, 0x0000008001020408,
0x0020000001000408, 0x1000408001020008, 0x1000000001000408, 0x1000000001000400,
0x0020408000000000, 0x0000408001020400, 0x1000408000020008, 0x0020400000020400,
0x0020000001000000, 0x0000000000000408, 0x1020408000020400, 0x0000000001020400,
0x0020400000000008, 0x0000408000020008, 0x0020008000020408, 0x1000408001000008,
0x1000000000020400, 0x1020000000000008, 0x0000008001020008, 0x1000008001020400,
0x1020400000000008, 0x1020408001000000, 0x1000008001000000, 0x0000008000000008,
0x0020400001000008, 0x1020008001000008, 0x1000000001020400, 0x1000008000020000,
0x1000008001000408, 0x0000008001020400, 0x1000000000020408, 0x1020400001000008,
0x1020000001020400, 0x0020008000020008, 0x0000400001000000, 0x1020008001020408,
0x1000000001020000, 0x1000400000000008, 0x1000000001000008, 0x0000000001020008,
0x1000408001020408, 0x1020400000020400, 0x0020000000000400, 0x0020400001000000,
0x0020000000000008, 0x1000008001000008, 0x0000400001020008, 0x0000000001020408,
0x1000408000000000, 0x0020008000020000, 0x1000408001000408, 0x0000008000020400,
};
static const uint64_t spb6[] = {
0x0040800000000810, 0x0040800102040000, 0x0040800100040810, 0x0040800102000810,
0x2040800100000800, 0x0040800002000810, 0x0040800002040810, 0x2040000000040010,
0x0000800100000000, 0x0000000000000010, 0x0040800000040810, 0x0000800002000810,
0x2040800102040800, 0x2040000100040810, 0x2000800002000810, 0x0040800100040800,
0x2040000002000800, 0x2000000000000800, 0x2040000002000010, 0x0040800102040010,
0x2040800102000800, 0x0040000102000010, 0x0040000000040810, 0x2040800100000000,
0x2000800002040010, 0x2040000100040000, 0x2000800000000800, 0x2000800002040810,
0x2000000102040000, 0x2000800000040000, 0x0040800100000800, 0x2040000000000000,
0x2000800100040810, 0x2040800102040010, 0x2000000100000810, 0x0000800000040800,
0x0000800100040800, 0x0000800102040810, 0x2040800100040810, 0x2040000002040000,
0x0000800100040000, 0x2000800000040010, 0x2040800000040010, 0x2040800100000010,
0x0040800100000010, 0x2040000102000000, 0x0000800100000010, 0x0000000100040010,
0x0000000000040000, 0x2040000000040810, 0x0000800000000810, 0x2040000000000810,
0x0000000102000000, 0x2000000100040800, 0x0000000000040010, 0x2000000102000800,
0x0000000000040810, 0x0000000100000800, 0x2000000000000000, 0x2040800000000800,
0x2040800002000810, 0x0000800000040810, 0x2000800100000800, 0x0040800100040010,
0x0000000002000010, 0x2000000000000810, 0x0000800002040000, 0x0000000102000800,
0x0000000102000810, 0x0040800002040800, 0x0040000102000800, 0x2000800000000000,
0x0040000100000800, 0x0000800102000810, 0x2040000100040800, 0x2000800100000810,
0x0000800002000010, 0x2040800000000810, 0x0000800002040810, 0x2000000000040000,
0x0040000100000810, 0x2040000100000010, 0x0000000000000000, 0x2040800002040010,
0x0000800000000000, 0x2040800102040000, 0x2000800100000010, 0x0040000102000810,
0x0040800002000800, 0x2040000002000810, 0x2000800102040800, 0x0000800102000010,
0x0040000002000800, 0x0040000002040000, 0x0040000102000000, 0x2040000002040810,
0x2040000100000000, 0x2040800002040810, 0x2000800002000800, 0x2040800102000810,
0x0040000000000810, 0x0040000002040010, 0x0000800100000810, 0x2000000000040010,
0x0040000000040010, 0x2040800102000010, 0x0000000000000800, 0x0040800102040810,
0x0040000100000000, 0x0000800102040000, 0x2000000102040810, 0x2000800002000000,
0x0040000100000010, 0x2000800000000810, 0x0040000000000000, 0x2000000002040810,
0x2000000100000800, 0x2000000102040010, 0x0000800102000000, 0x2040800100040010,
0x2000800102040000, 0x2000800100040800, 0x2040000102000800, 0x0000800000000010,
0x0000000100000000, 0x2040800102040810, 0x2040800100000810, 0x2040000100000800,
0x2040000002040010, 0x0000000002040000, 0x0000000100000810, 0x2040800002040000,
0x0040000102040810, 0x2000000100040810, 0x0040000000040000, 0x0000000100040810,
0x2040000000040000, 0x2000800000040810, 0x0040800102040800, 0x0000800102040010,
0x0040800000040000, 0x0040000102040010, 0x0000000102000010, 0x0040800100000810,
0x0040800000000000, 0x2000000000000010, 0x0040000002040810, 0x2040000102040000,
0x0000800000000800, 0x0000800002000800, 0x2000000100000000, 0x2000000002000000,
0x0040000000040800, 0x2040800002040800, 0x2000800102000000, 0x0000000100040000,
0x2040000102040800, 0x0040000102040800, 0x0000000002000810, 0x2040000102000810,
0x2040800000000000, 0x0000800100000800, 0x0000800102000800, 0x0000000002000800,
0x0040000002000010, 0x0000000000040800, 0x0000800000040000, 0x0040000102040000,
0x2040000000000800, 0x2040000100000810, 0x2000800002040000, 0x0040800000000800,
0x2000000100000010, 0x2000000100040010, 0x2040800000040000, 0x0040800102000010,
0x2040800000040810, 0x2040000002000000, 0x0000800100040810, 0x0040800002040010,
0x2000000002040010, 0x2040000100040010, 0x0040000002040800, 0x2000800002000010,
0x0040800002040000, 0x0040000100040800, 0x2040800100040000, 0x2040800002000800,
0x0040800000040010, 0x0040800102000800, 0x2000800002040800, 0x0000000002000000,
0x2000800102000800, 0x0040800102000000, 0x0000800000040010, 0x0000800002040800,
0x0000000102040000, 0x2000800000040800, 0x2000800100040000, 0x2040000000040800,
0x2040800002000000, 0x2040000102040010, 0x0040800100040000, 0x0000000102040810,
0x0040000002000810, 0x2000800102040010, 0x2000000002000810, 0x2000000002000800,
0x0040800100000000, 0x0000800102040800, 0x2000800100040010, 0x0040800000040800,
0x0040000002000000, 0x0000000000000810, 0x2040800100040800, 0x0000000002040800,
0x0040800000000010, 0x0000800100040010, 0x0040000100040810, 0x2000800102000010,
0x2000000000040800, 0x2040000000000010, 0x0000000102040010, 0x2000000102040800,
0x2040800000000010, 0x2040800102000000, 0x2000000102000000, 0x0000000100000010,
0x0040800002000010, 0x2040000102000010, 0x2000000002040800, 0x2000000100040000,
0x2000000102000810, 0x0000000102040800, 0x2000000000040810, 0x2040800002000010,
0x2040000002040800, 0x0040000100040010, 0x0000800002000000, 0x2040000102040810,
0x2000000002040000, 0x2000800000000010, 0x2000000002000010, 0x0000000002040010,
0x2000800102040810, 0x2040800000040800, 0x0040000000000800, 0x0040800002000000,
0x0040000000000010, 0x2000000102000010, 0x0000800002040010, 0x0000000002040810,
0x2000800100000000, 0x0040000100040000, 0x2000800102000810, 0x0000000100040800,
};
static const uint64_t spb7[] = {
0x0080010000001020, 0x0080010204080000, 0x0080010200081020, 0x0080010204001020,
0x4080010200001000, 0x0080010004001020, 0x0080010004081020, 0x4080000000080020,
0x0000010200000000, 0x0000000000000020, 0x0080010000081020, 0x0000010004001020,
0x4080010204081000, 0x4080000200081020, 0x4000010004001020, 0x0080010200081000,
0x4080000004001000, 0x4000000000001000, 0x4080000004000020, 0x0080010204080020,
0x4080010204001000, 0x0080000204000020, 0x0080000000081020, 0x4080010200000000,
0x4000010004080020, 0x4080000200080000, 0x4000010000001000, 0x4000010004081020,
0x4000000204080000, 0x4000010000080000, 0x0080010200001000, 0x4080000000000000,
0x4000010200081020, 0x4080010204080020, 0x4000000200001020, 0x0000010000081000,
0x0000010200081000, 0x0000010204081020, 0x4080010200081020, 0x4080000004080000,
0x0000010200080000, 0x4000010000080020, 0x4080010000080020, 0x4080010200000020,
0x0080010200000020, 0x4080000204000000, 0x0000010200000020, 0x0000000200080020,
0x0000000000080000, 0x4080000000081020, 0x0000010000001020, 0x4080000000001020,
0x0000000204000000, 0x4000000200081000, 0x0000000000080020, 0x4000000204001000,
0x0000000000081020, 0x0000000200001000, 0x4000000000000000, 0x4080010000001000,
0x4080010004001020, 0x0000010000081020, 0x4000010200001000, 0x0080010200080020,
0x0000000004000020, 0x4000000000001020, 0x0000010004080000, 0x0000000204001000,
0x0000000204001020, 0x0080010004081000, 0x0080000204001000, 0x4000010000000000,
0x0080000200001000, 0x0000010204001020, 0x4080000200081000, 0x4000010200001020,
0x0000010004000020, 0x4080010000001020, 0x0000010004081020, 0x4000000000080000,
0x0080000200001020, 0x4080000200000020, 0x0000000000000000, 0x4080010004080020,
0x0000010000000000, 0x4080010204080000, 0x4000010200000020, 0x0080000204001020,
0x0080010004001000, 0x4080000004001020, 0x4000010204081000, 0x0000010204000020,
0x0080000004001000, 0x0080000004080000, 0x0080000204000000, 0x4080000004081020,
0x4080000200000000, 0x4080010004081020, 0x4000010004001000, 0x4080010204001020,
0x0080000000001020, 0x0080000004080020, 0x0000010200001020, 0x4000000000080020,
0x0080000000080020, 0x4080010204000020, 0x0000000000001000, 0x0080010204081020,
0x0080000200000000, 0x0000010204080000, 0x4000000204081020, 0x4000010004000000,
0x0080000200000020, 0x4000010000001020, 0x0080000000000000, 0x4000000004081020,
0x4000000200001000, 0x4000000204080020, 0x0000010204000000, 0x4080010200080020,
0x4000010204080000, 0x4000010200081000, 0x4080000204001000, 0x0000010000000020,
0x0000000200000000, 0x4080010204081020, 0x4080010200001020, 0x4080000200001000,
0x4080000004080020, 0x0000000004080000, 0x0000000200001020, 0x4080010004080000,
0x0080000204081020, 0x4000000200081020, 0x0080000000080000, 0x0000000200081020,
0x4080000000080000, 0x4000010000081020, 0x0080010204081000, 0x0000010204080020,
0x0080010000080000, 0x0080000204080020, 0x0000000204000020, 0x0080010200001020,
0x0080010000000000, 0x4000000000000020, 0x0080000004081020, 0x4080000204080000,
0x0000010000001000, 0x0000010004001000, 0x4000000200000000, 0x4000000004000000,
0x0080000000081000, 0x4080010004081000, 0x4000010204000000, 0x0000000200080000,
0x4080000204081000, 0x0080000204081000, 0x0000000004001020, 0x4080000204001020,
0x4080010000000000, 0x0000010200001000, 0x0000010204001000, 0x0000000004001000,
0x0080000004000020, 0x0000000000081000, 0x0000010000080000, 0x0080000204080000,
0x4080000000001000, 0x4080000200001020, 0x4000010004080000, 0x0080010000001000,
0x4000000200000020, 0x4000000200080020, 0x4080010000080000, 0x0080010204000020,
0x4080010000081020, 0x4080000004000000, 0x0000010200081020, 0x0080010004080020,
0x4000000004080020, 0x4080000200080020, 0x0080000004081000, 0x4000010004000020,
0x0080010004080000, 0x0080000200081000, 0x4080010200080000, 0x4080010004001000,
0x0080010000080020, 0x0080010204001000, 0x4000010004081000, 0x0000000004000000,
0x4000010204001000, 0x0080010204000000, 0x0000010000080020, 0x0000010004081000,
0x0000000204080000, 0x4000010000081000, 0x4000010200080000, 0x4080000000081000,
0x4080010004000000, 0x4080000204080020, 0x0080010200080000, 0x0000000204081020,
0x0080000004001020, 0x4000010204080020, 0x4000000004001020, 0x4000000004001000,
0x0080010200000000, 0x0000010204081000, 0x4000010200080020, 0x0080010000081000,
0x0080000004000000, 0x0000000000001020, 0x4080010200081000, 0x0000000004081000,
0x0080010000000020, 0x0000010200080020, 0x0080000200081020, 0x4000010204000020,
0x4000000000081000, 0x4080000000000020, 0x0000000204080020, 0x4000000204081000,
0x4080010000000020, 0x4080010204000000, 0x4000000204000000, 0x0000000200000020,
0x0080010004000020, 0x4080000204000020, 0x4000000004081000, 0x4000000200080000,
0x4000000204001020, 0x0000000204081000, 0x4000000000081020, 0x4080010004000020,
0x4080000004081000, 0x0080000200080020, 0x0000010004000000, 0x4080000204081020,
0x4000000004080000, 0x4000010000000020, 0x4000000004000020, 0x0000000004080020,
0x4000010204081020, 0x4080010000081000, 0x0080000000001000, 0x0080010004000000,
0x0080000000000020, 0x4000000204000020, 0x0000010004080020, 0x0000000004081020,
0x4000010200000000, 0x0080000200080000, 0x4000010204001020, 0x0000000200081000,
};
static const uint64_t spb8[] = {
0x0001020000002040, 0x0001020408100000, 0x0001020400102040, 0x0001020408002040,
0x8001020400002000, 0x0001020008002040, 0x0001020008102040, 0x8001000000100040,
0x0000020400000000, 0x0000000000000040, 0x0001020000102040, 0x0000020008002040,
0x8001020408102000, 0x8001000400102040, 0x8000020008002040, 0x0001020400102000,
0x8001000008002000, 0x8000000000002000, 0x8001000008000040, 0x0001020408100040,
0x8001020408002000, 0x0001000408000040, 0x0001000000102040, 0x8001020400000000,
0x8000020008100040, 0x8001000400100000, 0x8000020000002000, 0x8000020008102040,
0x8000000408100000, 0x8000020000100000, 0x0001020400002000, 0x8001000000000000,
0x8000020400102040, 0x8001020408100040, 0x8000000400002040, 0x0000020000102000,
0x0000020400102000, 0x0000020408102040, 0x8001020400102040, 0x8001000008100000,
0x0000020400100000, 0x8000020000100040, 0x8001020000100040, 0x8001020400000040,
0x0001020400000040, 0x8001000408000000, 0x0000020400000040, 0x0000000400100040,
0x0000000000100000, 0x8001000000102040, 0x0000020000002040, 0x8001000000002040,
0x0000000408000000, 0x8000000400102000, 0x0000000000100040, 0x8000000408002000,
0x0000000000102040, 0x0000000400002000, 0x8000000000000000, 0x8001020000002000,
0x8001020008002040, 0x0000020000102040, 0x8000020400002000, 0x0001020400100040,
0x0000000008000040, 0x8000000000002040, 0x0000020008100000, 0x0000000408002000,
0x0000000408002040, 0x0001020008102000, 0x0001000408002000, 0x8000020000000000,
0x0001000400002000, 0x0000020408002040, 0x8001000400102000, 0x8000020400002040,
0x0000020008000040, 0x8001020000002040, 0x0000020008102040, 0x8000000000100000,
0x0001000400002040, 0x8001000400000040, 0x0000000000000000, 0x8001020008100040,
0x0000020000000000, 0x8001020408100000, 0x8000020400000040, 0x0001000408002040,
0x0001020008002000, 0x8001000008002040, 0x8000020408102000, 0x0000020408000040,
0x0001000008002000, 0x0001000008100000, 0x0001000408000000, 0x8001000008102040,
0x8001000400000000, 0x8001020008102040, 0x8000020008002000, 0x8001020408002040,
0x0001000000002040, 0x0001000008100040, 0x0000020400002040, 0x8000000000100040,
0x0001000000100040, 0x8001020408000040, 0x0000000000002000, 0x0001020408102040,
0x0001000400000000, 0x0000020408100000, 0x8000000408102040, 0x8000020008000000,
0x0001000400000040, 0x8000020000002040, 0x0001000000000000, 0x8000000008102040,
0x8000000400002000, 0x8000000408100040, 0x0000020408000000, 0x8001020400100040,
0x8000020408100000, 0x8000020400102000, 0x8001000408002000, 0x0000020000000040,
0x0000000400000000, 0x8001020408102040, 0x8001020400002040, 0x8001000400002000,
0x8001000008100040, 0x0000000008100000, 0x0000000400002040, 0x8001020008100000,
0x0001000408102040, 0x8000000400102040, 0x0001000000100000, 0x0000000400102040,
0x8001000000100000, 0x8000020000102040, 0x0001020408102000, 0x0000020408100040,
0x0001020000100000, 0x0001000408100040, 0x0000000408000040, 0x0001020400002040,
0x0001020000000000, 0x8000000000000040, 0x0001000008102040, 0x8001000408100000,
0x0000020000002000, 0x0000020008002000, 0x8000000400000000, 0x8000000008000000,
0x0001000000102000, 0x8001020008102000, 0x8000020408000000, 0x0000000400100000,
0x8001000408102000, 0x0001000408102000, 0x0000000008002040, 0x8001000408002040,
0x8001020000000000, 0x0000020400002000, 0x0000020408002000, 0x0000000008002000,
0x0001000008000040, 0x0000000000102000, 0x0000020000100000, 0x0001000408100000,
0x8001000000002000, 0x8001000400002040, 0x8000020008100000, 0x0001020000002000,
0x8000000400000040, 0x8000000400100040, 0x8001020000100000, 0x0001020408000040,
0x8001020000102040, 0x8001000008000000, 0x0000020400102040, 0x0001020008100040,
0x8000000008100040, 0x8001000400100040, 0x0001000008102000, 0x8000020008000040,
0x0001020008100000, 0x0001000400102000, 0x8001020400100000, 0x8001020008002000,
0x0001020000100040, 0x0001020408002000, 0x8000020008102000, 0x0000000008000000,
0x8000020408002000, 0x0001020408000000, 0x0000020000100040, 0x0000020008102000,
0x0000000408100000, 0x8000020000102000, 0x8000020400100000, 0x8001000000102000,
0x8001020008000000, 0x8001000408100040, 0x0001020400100000, 0x0000000408102040,
0x0001000008002040, 0x8000020408100040, 0x8000000008002040, 0x8000000008002000,
0x0001020400000000, 0x0000020408102000, 0x8000020400100040, 0x0001020000102000,
0x0001000008000000, 0x0000000000002040, 0x8001020400102000, 0x0000000008102000,
0x0001020000000040, 0x0000020400100040, 0x0001000400102040, 0x8000020408000040,
0x8000000000102000, 0x8001000000000040, 0x0000000408100040, 0x8000000408102000,
0x8001020000000040, 0x8001020408000000, 0x8000000408000000, 0x0000000400000040,
0x0001020008000040, 0x8001000408000040, 0x8000000008102000, 0x8000000400100000,
0x8000000408002040, 0x0000000408102000, 0x8000000000102040, 0x8001020008000040,
0x8001000008102000, 0x0001000400100040, 0x0000020008000000, 0x8001000408102040,
0x8000000008100000, 0x8000020000000040, 0x8000000008000040, 0x0000000008100040,
0x8000020408102040, 0x8001020000102000, 0x0001000000002000, 0x0001020008000000,
0x0001000000000040, 0x8000000408000040, 0x0000020008100040, 0x0000000008102040,
0x8000020400000000, 0x0001000400100000, 0x8000020408002040, 0x0000000400102000,
};
static inline uint64_t
spbox(const uint64_t h)
{
unsigned char *s = (unsigned char *)&h;
return spb1[s[0]] | spb2[s[1]] | spb3[s[2]] | spb4[s[3]] |
spb5[s[4]] | spb6[s[5]] | spb7[s[6]] | spb8[s[7]];
}
static inline uint64_t
mix64(const uint64_t h)
{
return spbox(spbox(spbox(spbox(spbox(h)))));
}
static inline uint64_t
round64(const uint64_t h, const uint64_t x)
{
return mix64(h ^ x);
}
void
spb_hash_start_seed(spb_hash_state_t * const state, const uint64_t seed)
{
state->x1 = s1 ^ seed;
state->x2 = s2 ^ seed;
state->x3 = s3 ^ seed;
state->x4 = s4 ^ seed;
state->block_size = sizeof(state->buf);
state->count = 0;
state->total_len = 0;
}
void
spb_hash_start(spb_hash_state_t * const state)
{
spb_hash_start_seed(state, 0);
}
void
spb_hash_update(spb_hash_state_t * const state, const void * const data,
const size_t len)
{
const unsigned char *curr = data;
size_t llen;
uint64_t *v;
uint64_t x1, x2, x3, x4;
uint32_t left;
if (data == NULL || len == 0)
return;
state->total_len += len;
if (state->count + len < state->block_size) {
memcpy(state->buf.chars + state->count, data, len);
state->count += len;
return;
}
llen = len;
x1 = state->x1;
x2 = state->x2;
x3 = state->x3;
x4 = state->x4;
if (state->count > 0) {
left = state->block_size - state->count;
memcpy(state->buf.chars + state->count, data, left);
llen -= left;
curr += left;
v = state->buf.ints;
x1 = round64(x1, v[0]);
x2 = round64(x2, v[1]);
x3 = round64(x3, v[2]);
x4 = round64(x4, v[3]);
state->count = 0;
}
while (llen >= state->block_size) {
x1 = round64(x1, readmem64(curr));
x2 = round64(x2, readmem64(curr+8));
x3 = round64(x3, readmem64(curr+16));
x4 = round64(x4, readmem64(curr+24));
curr += state->block_size;
llen -= state->block_size;
}
state->x1 = x1;
state->x2 = x2;
state->x3 = x3;
state->x4 = x4;
if (llen > 0) {
memcpy(state->buf.chars, curr, llen);
state->count = llen;
}
}
static const unsigned char padding[256] = { 0x80 };
void
spb_hash_end(spb_hash_state_t * const state, spb_hash_t * const hash)
{
uint64_t h, x1, x2, x3, x4;
uint64_t total_len;
uint32_t len;
total_len = state->total_len;
len = (state->count < 24) ? 24 - state->count : 56 - state->count;
spb_hash_update(state, padding, len);
spb_hash_update(state, &total_len, 8);
x1 = mix64(state->x1);
x2 = mix64(state->x2);
x3 = mix64(state->x3);
x4 = mix64(state->x4);
h = round64(0, x1);
h = round64(h, x2);
h = round64(h, x3);
h = round64(h, x4);
h = mix64(h);
memcpy(hash, &h, sizeof(h));
}
void
spb_hash_seed(const void * const data, const size_t len,
const uint64_t seed, spb_hash_t * const hash)
{
spb_hash_state_t state;
spb_hash_start_seed(&state, seed);
spb_hash_update(&state, data, len);
spb_hash_end(&state, hash);
}
void
spb_hash(const void * const data, const size_t len, spb_hash_t * const hash)
{
spb_hash_seed(data, len, 0, hash);
}