Rename tigersum to tthsum.
[doldaconnect.git] / config / tthsum.c
CommitLineData
2ae5dacf 1/*
2 * Dolda Connect - Modular multiuser Direct Connect-style client
3 * Copyright (C) 2004 Fredrik Tolf (fredrik@dolda2000.com)
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18*/
19
20/* This frankenfile is built from bits and pieces of the daemon. The
21 * copying and pasting is very ugly, but it doesn't *really*
22 * matter. */
23
24#include <stdlib.h>
25#include <unistd.h>
26#include <stdio.h>
27#include <string.h>
28#include <fcntl.h>
29#include <errno.h>
30
31#ifdef HAVE_CONFIG_H
32#include <config.h>
33#endif
34
35struct tigerhash {
36 unsigned long long a, b, c;
37 unsigned char block[64];
38 int offset;
39 size_t len;
40};
41
42struct tigertreehash {
43 int blocks;
44 char block[1024];
45 int offset;
46 char stack[64][24];
47 int depth;
48};
49
50char buf[32768], dbuf[512];
51
52static char *base64set = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
53static int base64rev[] = {
54 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
55 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
56 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63,
57 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1,
58 -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
59 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1,
60 -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
61 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1,
62 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
63 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
64 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
65 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
66 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
67 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
68 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
69 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
70};
71static char *base32set = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
72static int base32rev[] = {
73 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
74 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
75 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
76 -1, -1, 26, 27, 28, 29, 30, 31, -1, -1, -1, -1, -1, -1, -1, -1,
77 -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
78 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1,
79 -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
80 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1,
81 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
82 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
83 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
84 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
85 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
86 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
87 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
88 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
89};
90
91static unsigned long long table[];
92
93void inittiger(struct tigerhash *th)
94{
95 th->a = 0x0123456789abcdefULL;
96 th->b = 0xfedcba9876543210ULL;
97 th->c = 0xf096a5b4c3b2e187ULL;
98 th->offset = 0;
99 th->len = 0;
100}
101
102static void round(unsigned long long *a, unsigned long long *b, unsigned long long *c, unsigned long long x, int mul)
103{
104 *c ^= x;
105 *a -= table[((*c >> 0) & 0xff) + 0x0000] ^ table[((*c >> 16) & 0xff) + 0x0100] ^ table[((*c >> 32) & 0xff) + 0x0200] ^ table[((*c >> 48) & 0xff) + 0x0300];
106 *b += table[((*c >> 8) & 0xff) + 0x0300] ^ table[((*c >> 24) & 0xff) + 0x0200] ^ table[((*c >> 40) & 0xff) + 0x0100] ^ table[((*c >> 56) & 0xff) + 0x0000];
107 *b *= mul;
108}
109
110static void pass(unsigned long long *a, unsigned long long *b, unsigned long long *c, unsigned long long *x, int mul)
111{
112 round(a, b, c, x[0], mul);
113 round(b, c, a, x[1], mul);
114 round(c, a, b, x[2], mul);
115 round(a, b, c, x[3], mul);
116 round(b, c, a, x[4], mul);
117 round(c, a, b, x[5], mul);
118 round(a, b, c, x[6], mul);
119 round(b, c, a, x[7], mul);
120}
121
122static void key_schedule(unsigned long long *x)
123{
124 x[0] -= x[7] ^ 0xa5a5a5a5a5a5a5a5ULL;
125 x[1] ^= x[0];
126 x[2] += x[1];
127 x[3] -= x[2] ^ ((~x[1]) << 19);
128 x[4] ^= x[3];
129 x[5] += x[4];
130 x[6] -= x[5] ^ ((~x[4]) >> 23);
131 x[7] ^= x[6];
132 x[0] += x[7];
133 x[1] -= x[0] ^ ((~x[7]) << 19);
134 x[2] ^= x[1];
135 x[3] += x[2];
136 x[4] -= x[3] ^ ((~x[2]) >> 23);
137 x[5] ^= x[4];
138 x[6] += x[5];
139 x[7] -= x[6] ^ 0x0123456789abcdefULL;
140}
141
142static void doblock(struct tigerhash *th)
143{
144 int i, o;
145 unsigned long long x[8], aa, bb, cc;
146
147 for(i = 0; i < 8; i++) {
148 x[i] = 0;
149 for(o = 0; o < 8; o++) {
150 x[i] <<= 8;
151 x[i] |= th->block[(i * 8) + 7 - o];
152 }
153 }
154 aa = th->a;
155 bb = th->b;
156 cc = th->c;
157 pass(&th->a, &th->b, &th->c, x, 5);
158 key_schedule(x);
159 pass(&th->c, &th->a, &th->b, x, 7);
160 key_schedule(x);
161 pass(&th->b, &th->c, &th->a, x, 9);
162 th->a ^= aa;
163 th->b -= bb;
164 th->c += cc;
165 th->offset = 0;
166}
167
168void dotiger(struct tigerhash *th, char *buf, size_t buflen)
169{
170 int taken;
171
172 th->len += buflen;
173 while(buflen > 0) {
174 taken = buflen;
175 if(taken > 64 - th->offset)
176 taken = 64 - th->offset;
177 memcpy(th->block + th->offset, buf, taken);
178 th->offset += taken;
179 buflen -= taken;
180 buf += taken;
181 if(th->offset == 64)
182 doblock(th);
183 }
184}
185
186void synctiger(struct tigerhash *th)
187{
188 int i;
189 unsigned long long buf;
190
191 th->block[th->offset++] = 1;
192 while(th->offset & 7)
193 th->block[th->offset++] = 0;
194 if(th->offset > 56)
195 doblock(th);
196 if(th->offset < 56)
197 memset(th->block + th->offset, 0, 56 - th->offset);
198 buf = th->len << 3;
199 for(i = 0; i < 8; i++) {
200 th->block[56 + i] = buf & 0xff;
201 buf >>= 8;
202 }
203 doblock(th);
204}
205
206void restiger(struct tigerhash *th, char *rbuf)
207{
208 int i;
209 unsigned long long buf;
210
211 buf = th->a;
212 for(i = 0; i < 8; i++) {
213 rbuf[i] = buf & 0xff;
214 buf >>= 8;
215 }
216 buf = th->b;
217 for(; i < 16; i++) {
218 rbuf[i] = buf & 0xff;
219 buf >>= 8;
220 }
221 buf = th->c;
222 for(; i < 24; i++) {
223 rbuf[i] = buf & 0xff;
224 buf >>= 8;
225 }
226}
227
228void inittigertree(struct tigertreehash *tth)
229{
230 tth->blocks = 0;
231 tth->offset = 0;
232 tth->depth = 0;
233}
234
235static void combine(struct tigertreehash *tth)
236{
237 struct tigerhash th;
238
239 inittiger(&th);
240 dotiger(&th, "\001", 1);
241 tth->depth--;
242 dotiger(&th, tth->stack[tth->depth - 1], 24);
243 dotiger(&th, tth->stack[tth->depth], 24);
244 synctiger(&th);
245 restiger(&th, tth->stack[tth->depth - 1]);
246}
247
248void pushtigertree(struct tigertreehash *tth, char *buf)
249{
250 int nb;
251
252 memcpy(tth->stack[tth->depth++], buf, 24);
253 for(nb = ++tth->blocks; !(nb & 1); nb >>= 1)
254 combine(tth);
255}
256
257static void dotreeblock(struct tigertreehash *tth)
258{
259 struct tigerhash th;
260 int nb;
261
262 inittiger(&th);
263 dotiger(&th, "\0", 1);
264 dotiger(&th, tth->block, tth->offset);
265 synctiger(&th);
266 restiger(&th, tth->stack[tth->depth++]);
267 tth->offset = 0;
268 for(nb = ++tth->blocks; !(nb & 1); nb >>= 1)
269 combine(tth);
270}
271
272void dotigertree(struct tigertreehash *tth, char *buf, size_t buflen)
273{
274 int taken;
275
276 while(buflen > 0) {
277 taken = buflen;
278 if(taken > 1024 - tth->offset)
279 taken = 1024 - tth->offset;
280 memcpy(tth->block + tth->offset, buf, taken);
281 tth->offset += taken;
282 buflen -= taken;
283 buf += taken;
284 if(tth->offset == 1024)
285 dotreeblock(tth);
286 }
287}
288
289void synctigertree(struct tigertreehash *tth)
290{
291 if((tth->offset > 0) || (tth->blocks == 0))
292 dotreeblock(tth);
293 while(tth->depth > 1)
294 combine(tth);
295}
296
297void restigertree(struct tigertreehash *tth, char *rbuf)
298{
299 memcpy(rbuf, tth->stack[0], 24);
300}
301
302void hexencode(char *dest, char *data, size_t datalen)
303{
304 char this;
305 int off;
306 int dig;
307
308 off = 0;
309 for(; datalen > 0; datalen--, data++)
310 {
311 dig = (*data & 0xF0) >> 4;
312 if(dig > 9)
313 this = 'A' + dig - 10;
314 else
315 this = dig + '0';
316 dest[off++] = this;
317 dig = *data & 0x0F;
318 if(dig > 9)
319 this = 'A' + dig - 10;
320 else
321 this = dig + '0';
322 dest[off++] = this;
323 }
324 dest[off] = 0;
325}
326
327int hexdecode(char *dest, char *data, size_t *len)
328{
329 char this;
330 int off;
331
332 off = 0;
333 for(; *data; data++)
334 {
335 if((*data >= 'A') && (*data <= 'F'))
336 {
337 this = (this & 0x0F) | ((*data - 'A' + 10) << 4);
338 } else if((*data >= '0') && (*data <= '9')) {
339 this = (this & 0x0F) | ((*data - '0') << 4);
340 } else {
341 return(-1);
342 }
343 data++;
344 if(!*data)
345 return(-1);
346 if((*data >= 'A') && (*data <= 'F'))
347 {
348 this = (this & 0xF0) | (*data - 'A' + 10);
349 } else if((*data >= '0') && (*data <= '9')) {
350 this = (this & 0xF0) | (*data - '0');
351 } else {
352 return(-1);
353 }
354 dest[off++] = this;
355 }
356 dest[off] = 0;
357 if(len != NULL)
358 *len = off;
359 return(0);
360}
361
362void base64encode(char *dest, char *data, size_t datalen)
363{
364 int off;
365
366 if(datalen == 0) {
367 dest[0] = 0;
368 return;
369 }
370 off = 0;
371 while(datalen >= 3)
372 {
373 dest[off++] = base64set[(data[0] & 0xfc) >> 2];
374 dest[off++] = base64set[((data[0] & 0x03) << 4) | ((data[1] & 0xf0) >> 4)];
375 dest[off++] = base64set[((data[1] & 0x0f) << 2) | ((data[2] & 0xc0) >> 6)];
376 dest[off++] = base64set[data[2] & 0x3f];
377 datalen -= 3;
378 data += 3;
379 }
380 if(datalen == 1)
381 {
382 dest[off++] = base64set[(data[0] & 0xfc) >> 2];
383 dest[off++] = base64set[(data[0] & 0x03) << 4];
384 dest[off++] = '=';
385 dest[off++] = '=';
386 }
387 if(datalen == 2)
388 {
389 dest[off++] = base64set[(data[0] & 0xfc) >> 2];
390 dest[off++] = base64set[((data[0] & 0x03) << 4) | ((data[1] & 0xf0) >> 4)];
391 dest[off++] = base64set[(data[1] & 0x0f) << 2];
392 dest[off++] = '=';
393 }
394 dest[off] = 0;
395}
396
397int base64decode(char *dest, char *data, size_t *datalen)
398{
399 int b, c;
400 char cur;
401 int off;
402
403 off = 0;
404 cur = 0;
405 b = 8;
406 for(; *data > 0; data++)
407 {
408 c = (int)(unsigned char)*data;
409 if(c == '=')
410 break;
411 if(c == '\n')
412 continue;
413 if(base64rev[c] == -1)
414 return(-1);
415 b -= 6;
416 if(b <= 0)
417 {
418 cur |= base64rev[c] >> -b;
419 dest[off++] = cur;
420 b += 8;
421 cur = 0;
422 }
423 cur |= base64rev[c] << b;
424 }
425 if(datalen != NULL)
426 *datalen = off;
427 dest[off] = 0;
428 return(0);
429}
430
431void base32encode(char *dest, char *data, size_t datalen)
432{
433 int off;
434
435 if(datalen == 0) {
436 dest[0] = 0;
437 return;
438 }
439 off = 0;
440 while(datalen >= 5)
441 {
442 dest[off++] = base32set[((data[0] & 0xf8) >> 3)];
443 dest[off++] = base32set[((data[0] & 0x07) << 2) | ((data[1] & 0xc0) >> 6)];
444 dest[off++] = base32set[((data[1] & 0x3e) >> 1)];
445 dest[off++] = base32set[((data[1] & 0x01) << 4) | ((data[2] & 0xf0) >> 4)];
446 dest[off++] = base32set[((data[2] & 0x0f) << 1) | ((data[3] & 0x80) >> 7)];
447 dest[off++] = base32set[((data[3] & 0x7c) >> 2)];
448 dest[off++] = base32set[((data[3] & 0x03) << 3) | ((data[4] & 0xe0) >> 5)];
449 dest[off++] = base32set[data[4] & 0x1f];
450 datalen -= 5;
451 data += 5;
452 }
453 if(datalen == 1)
454 {
455 dest[off++] = base32set[((data[0] & 0xf8) >> 3)];
456 dest[off++] = base32set[((data[0] & 0x07) << 2)];
457 memcpy(dest + off, "======", 6);
458 off += 6;
459 }
460 if(datalen == 2)
461 {
462 dest[off++] = base32set[((data[0] & 0xf8) >> 3)];
463 dest[off++] = base32set[((data[0] & 0x07) << 2) | ((data[1] & 0xc0) >> 6)];
464 dest[off++] = base32set[((data[1] & 0x3e) >> 1)];
465 dest[off++] = base32set[((data[1] & 0x01) << 4)];
466 memcpy(dest + off, "====", 4);
467 off += 4;
468 }
469 if(datalen == 3)
470 {
471 dest[off++] = base32set[((data[0] & 0xf8) >> 3)];
472 dest[off++] = base32set[((data[0] & 0x07) << 2) | ((data[1] & 0xc0) >> 6)];
473 dest[off++] = base32set[((data[1] & 0x3e) >> 1)];
474 dest[off++] = base32set[((data[1] & 0x01) << 4) | ((data[2] & 0xf0) >> 4)];
475 dest[off++] = base32set[((data[2] & 0x0f) << 1)];
476 memcpy(dest + off, "===", 3);
477 off += 3;
478 }
479 if(datalen == 4)
480 {
481 dest[off++] = base32set[((data[0] & 0xf8) >> 3)];
482 dest[off++] = base32set[((data[0] & 0x07) << 2) | ((data[1] & 0xc0) >> 6)];
483 dest[off++] = base32set[((data[1] & 0x3e) >> 1)];
484 dest[off++] = base32set[((data[1] & 0x01) << 4) | ((data[2] & 0xf0) >> 4)];
485 dest[off++] = base32set[((data[2] & 0x0f) << 1) | ((data[3] & 0x80) >> 7)];
486 dest[off++] = base32set[((data[3] & 0x7c) >> 2)];
487 dest[off++] = base32set[((data[3] & 0x03) << 3)];
488 dest[off++] = '=';
489 }
490 dest[off] = 0;
491}
492
493int base32decode(char *dest, char *data, size_t *datalen)
494{
495 int b, c;
496 char cur;
497 int off;
498
499 off = 0;
500 cur = 0;
501 b = 8;
502 for(; *data > 0; data++)
503 {
504 c = (int)(unsigned char)*data;
505 if(c == '=')
506 break;
507 if(c == '\n')
508 continue;
509 if(base32rev[c] == -1)
510 return(-1);
511 b -= 5;
512 if(b <= 0)
513 {
514 cur |= base32rev[c] >> -b;
515 dest[off++] = cur;
516 b += 8;
517 cur = 0;
518 }
519 cur |= base32rev[c] << b;
520 }
521 if(datalen != NULL)
522 *datalen = off;
523 dest[off] = 0;
524 return(0);
525}
526
527int main(int argc, char **argv)
528{
529 int i, ret;
530 int c, fd, outfd;
531 int len, len2;
532 int filter, output;
533 struct tigertreehash tth;
534 char res[24];
535 char *statefile;
536 FILE *state;
537
538 filter = 0;
539 output = 4;
540 outfd = 3;
541 statefile = NULL;
542 while((c = getopt(argc, argv, "hf456F:s:")) != -1) {
543 switch(c) {
544 case '4':
545 case '5':
546 case '6':
547 output = c - '0';
548 break;
549 case 'f':
550 filter = 1;
551 break;
552 case 'F':
553 outfd = atoi(optarg);
554 break;
555 case 's':
556 statefile = optarg;
557 break;
558 case 'h':
559 case ':':
560 case '?':
561 default:
562 fprintf(stderr, "usage: tigersum [-h456] FILE...\n");
563 fprintf(stderr, " tigersum [-h456] [-F OUTFD] [-s STATEFILE] -f\n");
564 exit((c == 'h')?0:1);
565 }
566 }
567 if(filter) {
568 inittigertree(&tth);
569 if(statefile != NULL)
570 {
571 if(((state = fopen(statefile, "r")) == NULL) && (errno != ENOENT)) {
572 fprintf(stderr, "tigersum: %s: %s\n", statefile, strerror(errno));
573 exit(1);
574 }
575 if(state != NULL) {
576 if(fgets(buf, sizeof(buf), state) == NULL) {
577 fprintf(stderr, "tigersum: %s: could not read entire state\n", statefile);
578 exit(1);
579 }
580 tth.blocks = atoi(buf);
581 if(fgets(buf, sizeof(buf), state) == NULL) {
582 fprintf(stderr, "tigersum: %s: could not read entire state\n", statefile);
583 exit(1);
584 }
585 tth.depth = atoi(buf);
586 for(i = 0; i < tth.depth; i++) {
587 if(fgets(buf, sizeof(buf), state) == NULL) {
588 fprintf(stderr, "tigersum: %s: could not read entire state\n", statefile);
589 exit(1);
590 }
591 base64decode(dbuf, buf, &ret);
592 if(ret != 24) {
593 fprintf(stderr, "tigersum: %s: illegal state\n", statefile);
594 exit(1);
595 }
596 memcpy(tth.stack[i], dbuf, 24);
597 }
598 if(fgets(buf, sizeof(buf), state) == NULL) {
599 fprintf(stderr, "tigersum: %s: could not read entire state\n", statefile);
600 exit(1);
601 }
602 tth.offset = atoi(buf);
603 if(fgets(buf, sizeof(buf), state) == NULL) {
604 fprintf(stderr, "tigersum: %s: could not read entire state\n", statefile);
605 exit(1);
606 }
607 base64decode(dbuf, buf, &ret);
608 if(ret != tth.offset) {
609 fprintf(stderr, "tigersum: %s: illegal state\n", statefile);
610 exit(1);
611 }
612 memcpy(&tth.block, dbuf, tth.offset);
613 fclose(state);
614 }
615 }
616 while(1) {
617 ret = read(0, buf, sizeof(buf));
618 if(ret < 0) {
619 perror("tigersum: read");
620 exit(1);
621 }
622 if(ret == 0)
623 break;
624 len = ret;
625 for(len2 = 0; len2 < len; len2 += ret) {
626 if((ret = write(1, buf, ret)) < 0) {
627 perror("tigersum: write");
628 exit(1);
629 }
630 }
631 dotigertree(&tth, buf, len);
632 }
633 if(statefile != NULL) {
634 if((state = fopen(statefile, "w")) == NULL) {
635 fprintf(stderr, "tigersum: %s: %s\n", statefile, strerror(errno));
636 exit(1);
637 }
638 fprintf(state, "%i\n", tth.blocks);
639 fprintf(state, "%i\n", tth.depth);
640 for(i = 0; i < tth.depth; i++) {
641 base64encode(dbuf, tth.stack[i], 24);
642 fprintf(state, "%s\n", dbuf);
643 }
644 fprintf(state, "%i\n", tth.offset);
645 base64encode(dbuf, tth.block, tth.offset);
646 fputs(dbuf, state);
647 fputc('\n', state);
648 fclose(state);
649 }
650 synctigertree(&tth);
651 restigertree(&tth, res);
652 if(output == 4)
653 hexencode(dbuf, res, 24);
654 else if(output == 5)
655 base32encode(dbuf, res, 24);
656 else if(output == 6)
657 base64encode(dbuf, res, 24);
658 for(len = 0; len < strlen(dbuf); len += ret) {
659 if((ret = write(outfd, dbuf + len, strlen(dbuf) - len)) < 0) {
660 perror("tigersum: output");
661 exit(1);
662 }
663 }
664 write(outfd, "\n", 1);
665 } else {
666 for(i = optind; i < argc; i++) {
667 if(!strcmp(argv[i], "-")) {
668 fd = 0;
669 } else {
670 if((fd = open(argv[i], O_RDONLY)) < 0) {
671 fprintf(stderr, "tigersum: %s: %s\n", argv[i], strerror(errno));
672 exit(1);
673 }
674 }
675 inittigertree(&tth);
676 while(1) {
677 ret = read(fd, buf, sizeof(buf));
678 if(ret < 0) {
679 perror("tigersum: read");
680 exit(1);
681 }
682 if(ret == 0)
683 break;
684 dotigertree(&tth, buf, ret);
685 }
686 synctigertree(&tth);
687 restigertree(&tth, res);
688 if(output == 4)
689 hexencode(dbuf, res, 24);
690 else if(output == 5)
691 base32encode(dbuf, res, 24);
692 else if(output == 6)
693 base64encode(dbuf, res, 24);
694 if(argc - optind > 1)
695 printf("%s %s\n", dbuf, argv[i]);
696 else
697 printf("%s\n", dbuf);
698 close(fd);
699 }
700 }
701 return(0);
702}
703
704static unsigned long long table[1024] = {
705 0x02aab17cf7e90c5eULL, 0xac424b03e243a8ecULL,
706 0x72cd5be30dd5fcd3ULL, 0x6d019b93f6f97f3aULL,
707 0xcd9978ffd21f9193ULL, 0x7573a1c9708029e2ULL,
708 0xb164326b922a83c3ULL, 0x46883eee04915870ULL,
709 0xeaace3057103ece6ULL, 0xc54169b808a3535cULL,
710 0x4ce754918ddec47cULL, 0x0aa2f4dfdc0df40cULL,
711 0x10b76f18a74dbefaULL, 0xc6ccb6235ad1ab6aULL,
712 0x13726121572fe2ffULL, 0x1a488c6f199d921eULL,
713 0x4bc9f9f4da0007caULL, 0x26f5e6f6e85241c7ULL,
714 0x859079dbea5947b6ULL, 0x4f1885c5c99e8c92ULL,
715 0xd78e761ea96f864bULL, 0x8e36428c52b5c17dULL,
716 0x69cf6827373063c1ULL, 0xb607c93d9bb4c56eULL,
717 0x7d820e760e76b5eaULL, 0x645c9cc6f07fdc42ULL,
718 0xbf38a078243342e0ULL, 0x5f6b343c9d2e7d04ULL,
719 0xf2c28aeb600b0ec6ULL, 0x6c0ed85f7254bcacULL,
720 0x71592281a4db4fe5ULL, 0x1967fa69ce0fed9fULL,
721 0xfd5293f8b96545dbULL, 0xc879e9d7f2a7600bULL,
722 0x860248920193194eULL, 0xa4f9533b2d9cc0b3ULL,
723 0x9053836c15957613ULL, 0xdb6dcf8afc357bf1ULL,
724 0x18beea7a7a370f57ULL, 0x037117ca50b99066ULL,
725 0x6ab30a9774424a35ULL, 0xf4e92f02e325249bULL,
726 0x7739db07061ccae1ULL, 0xd8f3b49ceca42a05ULL,
727 0xbd56be3f51382f73ULL, 0x45faed5843b0bb28ULL,
728 0x1c813d5c11bf1f83ULL, 0x8af0e4b6d75fa169ULL,
729 0x33ee18a487ad9999ULL, 0x3c26e8eab1c94410ULL,
730 0xb510102bc0a822f9ULL, 0x141eef310ce6123bULL,
731 0xfc65b90059ddb154ULL, 0xe0158640c5e0e607ULL,
732 0x884e079826c3a3cfULL, 0x930d0d9523c535fdULL,
733 0x35638d754e9a2b00ULL, 0x4085fccf40469dd5ULL,
734 0xc4b17ad28be23a4cULL, 0xcab2f0fc6a3e6a2eULL,
735 0x2860971a6b943fcdULL, 0x3dde6ee212e30446ULL,
736 0x6222f32ae01765aeULL, 0x5d550bb5478308feULL,
737 0xa9efa98da0eda22aULL, 0xc351a71686c40da7ULL,
738 0x1105586d9c867c84ULL, 0xdcffee85fda22853ULL,
739 0xccfbd0262c5eef76ULL, 0xbaf294cb8990d201ULL,
740 0xe69464f52afad975ULL, 0x94b013afdf133e14ULL,
741 0x06a7d1a32823c958ULL, 0x6f95fe5130f61119ULL,
742 0xd92ab34e462c06c0ULL, 0xed7bde33887c71d2ULL,
743 0x79746d6e6518393eULL, 0x5ba419385d713329ULL,
744 0x7c1ba6b948a97564ULL, 0x31987c197bfdac67ULL,
745 0xde6c23c44b053d02ULL, 0x581c49fed002d64dULL,
746 0xdd474d6338261571ULL, 0xaa4546c3e473d062ULL,
747 0x928fce349455f860ULL, 0x48161bbacaab94d9ULL,
748 0x63912430770e6f68ULL, 0x6ec8a5e602c6641cULL,
749 0x87282515337ddd2bULL, 0x2cda6b42034b701bULL,
750 0xb03d37c181cb096dULL, 0xe108438266c71c6fULL,
751 0x2b3180c7eb51b255ULL, 0xdf92b82f96c08bbcULL,
752 0x5c68c8c0a632f3baULL, 0x5504cc861c3d0556ULL,
753 0xabbfa4e55fb26b8fULL, 0x41848b0ab3baceb4ULL,
754 0xb334a273aa445d32ULL, 0xbca696f0a85ad881ULL,
755 0x24f6ec65b528d56cULL, 0x0ce1512e90f4524aULL,
756 0x4e9dd79d5506d35aULL, 0x258905fac6ce9779ULL,
757 0x2019295b3e109b33ULL, 0xf8a9478b73a054ccULL,
758 0x2924f2f934417eb0ULL, 0x3993357d536d1bc4ULL,
759 0x38a81ac21db6ff8bULL, 0x47c4fbf17d6016bfULL,
760 0x1e0faadd7667e3f5ULL, 0x7abcff62938beb96ULL,
761 0xa78dad948fc179c9ULL, 0x8f1f98b72911e50dULL,
762 0x61e48eae27121a91ULL, 0x4d62f7ad31859808ULL,
763 0xeceba345ef5ceaebULL, 0xf5ceb25ebc9684ceULL,
764 0xf633e20cb7f76221ULL, 0xa32cdf06ab8293e4ULL,
765 0x985a202ca5ee2ca4ULL, 0xcf0b8447cc8a8fb1ULL,
766 0x9f765244979859a3ULL, 0xa8d516b1a1240017ULL,
767 0x0bd7ba3ebb5dc726ULL, 0xe54bca55b86adb39ULL,
768 0x1d7a3afd6c478063ULL, 0x519ec608e7669eddULL,
769 0x0e5715a2d149aa23ULL, 0x177d4571848ff194ULL,
770 0xeeb55f3241014c22ULL, 0x0f5e5ca13a6e2ec2ULL,
771 0x8029927b75f5c361ULL, 0xad139fabc3d6e436ULL,
772 0x0d5df1a94ccf402fULL, 0x3e8bd948bea5dfc8ULL,
773 0xa5a0d357bd3ff77eULL, 0xa2d12e251f74f645ULL,
774 0x66fd9e525e81a082ULL, 0x2e0c90ce7f687a49ULL,
775 0xc2e8bcbeba973bc5ULL, 0x000001bce509745fULL,
776 0x423777bbe6dab3d6ULL, 0xd1661c7eaef06eb5ULL,
777 0xa1781f354daacfd8ULL, 0x2d11284a2b16affcULL,
778 0xf1fc4f67fa891d1fULL, 0x73ecc25dcb920adaULL,
779 0xae610c22c2a12651ULL, 0x96e0a810d356b78aULL,
780 0x5a9a381f2fe7870fULL, 0xd5ad62ede94e5530ULL,
781 0xd225e5e8368d1427ULL, 0x65977b70c7af4631ULL,
782 0x99f889b2de39d74fULL, 0x233f30bf54e1d143ULL,
783 0x9a9675d3d9a63c97ULL, 0x5470554ff334f9a8ULL,
784 0x166acb744a4f5688ULL, 0x70c74caab2e4aeadULL,
785 0xf0d091646f294d12ULL, 0x57b82a89684031d1ULL,
786 0xefd95a5a61be0b6bULL, 0x2fbd12e969f2f29aULL,
787 0x9bd37013feff9fe8ULL, 0x3f9b0404d6085a06ULL,
788 0x4940c1f3166cfe15ULL, 0x09542c4dcdf3defbULL,
789 0xb4c5218385cd5ce3ULL, 0xc935b7dc4462a641ULL,
790 0x3417f8a68ed3b63fULL, 0xb80959295b215b40ULL,
791 0xf99cdaef3b8c8572ULL, 0x018c0614f8fcb95dULL,
792 0x1b14accd1a3acdf3ULL, 0x84d471f200bb732dULL,
793 0xc1a3110e95e8da16ULL, 0x430a7220bf1a82b8ULL,
794 0xb77e090d39df210eULL, 0x5ef4bd9f3cd05e9dULL,
795 0x9d4ff6da7e57a444ULL, 0xda1d60e183d4a5f8ULL,
796 0xb287c38417998e47ULL, 0xfe3edc121bb31886ULL,
797 0xc7fe3ccc980ccbefULL, 0xe46fb590189bfd03ULL,
798 0x3732fd469a4c57dcULL, 0x7ef700a07cf1ad65ULL,
799 0x59c64468a31d8859ULL, 0x762fb0b4d45b61f6ULL,
800 0x155baed099047718ULL, 0x68755e4c3d50baa6ULL,
801 0xe9214e7f22d8b4dfULL, 0x2addbf532eac95f4ULL,
802 0x32ae3909b4bd0109ULL, 0x834df537b08e3450ULL,
803 0xfa209da84220728dULL, 0x9e691d9b9efe23f7ULL,
804 0x0446d288c4ae8d7fULL, 0x7b4cc524e169785bULL,
805 0x21d87f0135ca1385ULL, 0xcebb400f137b8aa5ULL,
806 0x272e2b66580796beULL, 0x3612264125c2b0deULL,
807 0x057702bdad1efbb2ULL, 0xd4babb8eacf84be9ULL,
808 0x91583139641bc67bULL, 0x8bdc2de08036e024ULL,
809 0x603c8156f49f68edULL, 0xf7d236f7dbef5111ULL,
810 0x9727c4598ad21e80ULL, 0xa08a0896670a5fd7ULL,
811 0xcb4a8f4309eba9cbULL, 0x81af564b0f7036a1ULL,
812 0xc0b99aa778199abdULL, 0x959f1ec83fc8e952ULL,
813 0x8c505077794a81b9ULL, 0x3acaaf8f056338f0ULL,
814 0x07b43f50627a6778ULL, 0x4a44ab49f5eccc77ULL,
815 0x3bc3d6e4b679ee98ULL, 0x9cc0d4d1cf14108cULL,
816 0x4406c00b206bc8a0ULL, 0x82a18854c8d72d89ULL,
817 0x67e366b35c3c432cULL, 0xb923dd61102b37f2ULL,
818 0x56ab2779d884271dULL, 0xbe83e1b0ff1525afULL,
819 0xfb7c65d4217e49a9ULL, 0x6bdbe0e76d48e7d4ULL,
820 0x08df828745d9179eULL, 0x22ea6a9add53bd34ULL,
821 0xe36e141c5622200aULL, 0x7f805d1b8cb750eeULL,
822 0xafe5c7a59f58e837ULL, 0xe27f996a4fb1c23cULL,
823 0xd3867dfb0775f0d0ULL, 0xd0e673de6e88891aULL,
824 0x123aeb9eafb86c25ULL, 0x30f1d5d5c145b895ULL,
825 0xbb434a2dee7269e7ULL, 0x78cb67ecf931fa38ULL,
826 0xf33b0372323bbf9cULL, 0x52d66336fb279c74ULL,
827 0x505f33ac0afb4eaaULL, 0xe8a5cd99a2cce187ULL,
828 0x534974801e2d30bbULL, 0x8d2d5711d5876d90ULL,
829 0x1f1a412891bc038eULL, 0xd6e2e71d82e56648ULL,
830 0x74036c3a497732b7ULL, 0x89b67ed96361f5abULL,
831 0xffed95d8f1ea02a2ULL, 0xe72b3bd61464d43dULL,
832 0xa6300f170bdc4820ULL, 0xebc18760ed78a77aULL,
833 0xe6a6be5a05a12138ULL, 0xb5a122a5b4f87c98ULL,
834 0x563c6089140b6990ULL, 0x4c46cb2e391f5dd5ULL,
835 0xd932addbc9b79434ULL, 0x08ea70e42015aff5ULL,
836 0xd765a6673e478cf1ULL, 0xc4fb757eab278d99ULL,
837 0xdf11c6862d6e0692ULL, 0xddeb84f10d7f3b16ULL,
838 0x6f2ef604a665ea04ULL, 0x4a8e0f0ff0e0dfb3ULL,
839 0xa5edeef83dbcba51ULL, 0xfc4f0a2a0ea4371eULL,
840 0xe83e1da85cb38429ULL, 0xdc8ff882ba1b1ce2ULL,
841 0xcd45505e8353e80dULL, 0x18d19a00d4db0717ULL,
842 0x34a0cfeda5f38101ULL, 0x0be77e518887caf2ULL,
843 0x1e341438b3c45136ULL, 0xe05797f49089ccf9ULL,
844 0xffd23f9df2591d14ULL, 0x543dda228595c5cdULL,
845 0x661f81fd99052a33ULL, 0x8736e641db0f7b76ULL,
846 0x15227725418e5307ULL, 0xe25f7f46162eb2faULL,
847 0x48a8b2126c13d9feULL, 0xafdc541792e76eeaULL,
848 0x03d912bfc6d1898fULL, 0x31b1aafa1b83f51bULL,
849 0xf1ac2796e42ab7d9ULL, 0x40a3a7d7fcd2ebacULL,
850 0x1056136d0afbbcc5ULL, 0x7889e1dd9a6d0c85ULL,
851 0xd33525782a7974aaULL, 0xa7e25d09078ac09bULL,
852 0xbd4138b3eac6edd0ULL, 0x920abfbe71eb9e70ULL,
853 0xa2a5d0f54fc2625cULL, 0xc054e36b0b1290a3ULL,
854 0xf6dd59ff62fe932bULL, 0x3537354511a8ac7dULL,
855 0xca845e9172fadcd4ULL, 0x84f82b60329d20dcULL,
856 0x79c62ce1cd672f18ULL, 0x8b09a2add124642cULL,
857 0xd0c1e96a19d9e726ULL, 0x5a786a9b4ba9500cULL,
858 0x0e020336634c43f3ULL, 0xc17b474aeb66d822ULL,
859 0x6a731ae3ec9baac2ULL, 0x8226667ae0840258ULL,
860 0x67d4567691caeca5ULL, 0x1d94155c4875adb5ULL,
861 0x6d00fd985b813fdfULL, 0x51286efcb774cd06ULL,
862 0x5e8834471fa744afULL, 0xf72ca0aee761ae2eULL,
863 0xbe40e4cdaee8e09aULL, 0xe9970bbb5118f665ULL,
864 0x726e4beb33df1964ULL, 0x703b000729199762ULL,
865 0x4631d816f5ef30a7ULL, 0xb880b5b51504a6beULL,
866 0x641793c37ed84b6cULL, 0x7b21ed77f6e97d96ULL,
867 0x776306312ef96b73ULL, 0xae528948e86ff3f4ULL,
868 0x53dbd7f286a3f8f8ULL, 0x16cadce74cfc1063ULL,
869 0x005c19bdfa52c6ddULL, 0x68868f5d64d46ad3ULL,
870 0x3a9d512ccf1e186aULL, 0x367e62c2385660aeULL,
871 0xe359e7ea77dcb1d7ULL, 0x526c0773749abe6eULL,
872 0x735ae5f9d09f734bULL, 0x493fc7cc8a558ba8ULL,
873 0xb0b9c1533041ab45ULL, 0x321958ba470a59bdULL,
874 0x852db00b5f46c393ULL, 0x91209b2bd336b0e5ULL,
875 0x6e604f7d659ef19fULL, 0xb99a8ae2782ccb24ULL,
876 0xccf52ab6c814c4c7ULL, 0x4727d9afbe11727bULL,
877 0x7e950d0c0121b34dULL, 0x756f435670ad471fULL,
878 0xf5add442615a6849ULL, 0x4e87e09980b9957aULL,
879 0x2acfa1df50aee355ULL, 0xd898263afd2fd556ULL,
880 0xc8f4924dd80c8fd6ULL, 0xcf99ca3d754a173aULL,
881 0xfe477bacaf91bf3cULL, 0xed5371f6d690c12dULL,
882 0x831a5c285e687094ULL, 0xc5d3c90a3708a0a4ULL,
883 0x0f7f903717d06580ULL, 0x19f9bb13b8fdf27fULL,
884 0xb1bd6f1b4d502843ULL, 0x1c761ba38fff4012ULL,
885 0x0d1530c4e2e21f3bULL, 0x8943ce69a7372c8aULL,
886 0xe5184e11feb5ce66ULL, 0x618bdb80bd736621ULL,
887 0x7d29bad68b574d0bULL, 0x81bb613e25e6fe5bULL,
888 0x071c9c10bc07913fULL, 0xc7beeb7909ac2d97ULL,
889 0xc3e58d353bc5d757ULL, 0xeb017892f38f61e8ULL,
890 0xd4effb9c9b1cc21aULL, 0x99727d26f494f7abULL,
891 0xa3e063a2956b3e03ULL, 0x9d4a8b9a4aa09c30ULL,
892 0x3f6ab7d500090fb4ULL, 0x9cc0f2a057268ac0ULL,
893 0x3dee9d2dedbf42d1ULL, 0x330f49c87960a972ULL,
894 0xc6b2720287421b41ULL, 0x0ac59ec07c00369cULL,
895 0xef4eac49cb353425ULL, 0xf450244eef0129d8ULL,
896 0x8acc46e5caf4deb6ULL, 0x2ffeab63989263f7ULL,
897 0x8f7cb9fe5d7a4578ULL, 0x5bd8f7644e634635ULL,
898 0x427a7315bf2dc900ULL, 0x17d0c4aa2125261cULL,
899 0x3992486c93518e50ULL, 0xb4cbfee0a2d7d4c3ULL,
900 0x7c75d6202c5ddd8dULL, 0xdbc295d8e35b6c61ULL,
901 0x60b369d302032b19ULL, 0xce42685fdce44132ULL,
902 0x06f3ddb9ddf65610ULL, 0x8ea4d21db5e148f0ULL,
903 0x20b0fce62fcd496fULL, 0x2c1b912358b0ee31ULL,
904 0xb28317b818f5a308ULL, 0xa89c1e189ca6d2cfULL,
905 0x0c6b18576aaadbc8ULL, 0xb65deaa91299fae3ULL,
906 0xfb2b794b7f1027e7ULL, 0x04e4317f443b5bebULL,
907 0x4b852d325939d0a6ULL, 0xd5ae6beefb207ffcULL,
908 0x309682b281c7d374ULL, 0xbae309a194c3b475ULL,
909 0x8cc3f97b13b49f05ULL, 0x98a9422ff8293967ULL,
910 0x244b16b01076ff7cULL, 0xf8bf571c663d67eeULL,
911 0x1f0d6758eee30da1ULL, 0xc9b611d97adeb9b7ULL,
912 0xb7afd5887b6c57a2ULL, 0x6290ae846b984fe1ULL,
913 0x94df4cdeacc1a5fdULL, 0x058a5bd1c5483affULL,
914 0x63166cc142ba3c37ULL, 0x8db8526eb2f76f40ULL,
915 0xe10880036f0d6d4eULL, 0x9e0523c9971d311dULL,
916 0x45ec2824cc7cd691ULL, 0x575b8359e62382c9ULL,
917 0xfa9e400dc4889995ULL, 0xd1823ecb45721568ULL,
918 0xdafd983b8206082fULL, 0xaa7d29082386a8cbULL,
919 0x269fcd4403b87588ULL, 0x1b91f5f728bdd1e0ULL,
920 0xe4669f39040201f6ULL, 0x7a1d7c218cf04adeULL,
921 0x65623c29d79ce5ceULL, 0x2368449096c00bb1ULL,
922 0xab9bf1879da503baULL, 0xbc23ecb1a458058eULL,
923 0x9a58df01bb401eccULL, 0xa070e868a85f143dULL,
924 0x4ff188307df2239eULL, 0x14d565b41a641183ULL,
925 0xee13337452701602ULL, 0x950e3dcf3f285e09ULL,
926 0x59930254b9c80953ULL, 0x3bf299408930da6dULL,
927 0xa955943f53691387ULL, 0xa15edecaa9cb8784ULL,
928 0x29142127352be9a0ULL, 0x76f0371fff4e7afbULL,
929 0x0239f450274f2228ULL, 0xbb073af01d5e868bULL,
930 0xbfc80571c10e96c1ULL, 0xd267088568222e23ULL,
931 0x9671a3d48e80b5b0ULL, 0x55b5d38ae193bb81ULL,
932 0x693ae2d0a18b04b8ULL, 0x5c48b4ecadd5335fULL,
933 0xfd743b194916a1caULL, 0x2577018134be98c4ULL,
934 0xe77987e83c54a4adULL, 0x28e11014da33e1b9ULL,
935 0x270cc59e226aa213ULL, 0x71495f756d1a5f60ULL,
936 0x9be853fb60afef77ULL, 0xadc786a7f7443dbfULL,
937 0x0904456173b29a82ULL, 0x58bc7a66c232bd5eULL,
938 0xf306558c673ac8b2ULL, 0x41f639c6b6c9772aULL,
939 0x216defe99fda35daULL, 0x11640cc71c7be615ULL,
940 0x93c43694565c5527ULL, 0xea038e6246777839ULL,
941 0xf9abf3ce5a3e2469ULL, 0x741e768d0fd312d2ULL,
942 0x0144b883ced652c6ULL, 0xc20b5a5ba33f8552ULL,
943 0x1ae69633c3435a9dULL, 0x97a28ca4088cfdecULL,
944 0x8824a43c1e96f420ULL, 0x37612fa66eeea746ULL,
945 0x6b4cb165f9cf0e5aULL, 0x43aa1c06a0abfb4aULL,
946 0x7f4dc26ff162796bULL, 0x6cbacc8e54ed9b0fULL,
947 0xa6b7ffefd2bb253eULL, 0x2e25bc95b0a29d4fULL,
948 0x86d6a58bdef1388cULL, 0xded74ac576b6f054ULL,
949 0x8030bdbc2b45805dULL, 0x3c81af70e94d9289ULL,
950 0x3eff6dda9e3100dbULL, 0xb38dc39fdfcc8847ULL,
951 0x123885528d17b87eULL, 0xf2da0ed240b1b642ULL,
952 0x44cefadcd54bf9a9ULL, 0x1312200e433c7ee6ULL,
953 0x9ffcc84f3a78c748ULL, 0xf0cd1f72248576bbULL,
954 0xec6974053638cfe4ULL, 0x2ba7b67c0cec4e4cULL,
955 0xac2f4df3e5ce32edULL, 0xcb33d14326ea4c11ULL,
956 0xa4e9044cc77e58bcULL, 0x5f513293d934fcefULL,
957 0x5dc9645506e55444ULL, 0x50de418f317de40aULL,
958 0x388cb31a69dde259ULL, 0x2db4a83455820a86ULL,
959 0x9010a91e84711ae9ULL, 0x4df7f0b7b1498371ULL,
960 0xd62a2eabc0977179ULL, 0x22fac097aa8d5c0eULL,
961 0xf49fcc2ff1daf39bULL, 0x487fd5c66ff29281ULL,
962 0xe8a30667fcdca83fULL, 0x2c9b4be3d2fcce63ULL,
963 0xda3ff74b93fbbbc2ULL, 0x2fa165d2fe70ba66ULL,
964 0xa103e279970e93d4ULL, 0xbecdec77b0e45e71ULL,
965 0xcfb41e723985e497ULL, 0xb70aaa025ef75017ULL,
966 0xd42309f03840b8e0ULL, 0x8efc1ad035898579ULL,
967 0x96c6920be2b2abc5ULL, 0x66af4163375a9172ULL,
968 0x2174abdcca7127fbULL, 0xb33ccea64a72ff41ULL,
969 0xf04a4933083066a5ULL, 0x8d970acdd7289af5ULL,
970 0x8f96e8e031c8c25eULL, 0xf3fec02276875d47ULL,
971 0xec7bf310056190ddULL, 0xf5adb0aebb0f1491ULL,
972 0x9b50f8850fd58892ULL, 0x4975488358b74de8ULL,
973 0xa3354ff691531c61ULL, 0x0702bbe481d2c6eeULL,
974 0x89fb24057deded98ULL, 0xac3075138596e902ULL,
975 0x1d2d3580172772edULL, 0xeb738fc28e6bc30dULL,
976 0x5854ef8f63044326ULL, 0x9e5c52325add3bbeULL,
977 0x90aa53cf325c4623ULL, 0xc1d24d51349dd067ULL,
978 0x2051cfeea69ea624ULL, 0x13220f0a862e7e4fULL,
979 0xce39399404e04864ULL, 0xd9c42ca47086fcb7ULL,
980 0x685ad2238a03e7ccULL, 0x066484b2ab2ff1dbULL,
981 0xfe9d5d70efbf79ecULL, 0x5b13b9dd9c481854ULL,
982 0x15f0d475ed1509adULL, 0x0bebcd060ec79851ULL,
983 0xd58c6791183ab7f8ULL, 0xd1187c5052f3eee4ULL,
984 0xc95d1192e54e82ffULL, 0x86eea14cb9ac6ca2ULL,
985 0x3485beb153677d5dULL, 0xdd191d781f8c492aULL,
986 0xf60866baa784ebf9ULL, 0x518f643ba2d08c74ULL,
987 0x8852e956e1087c22ULL, 0xa768cb8dc410ae8dULL,
988 0x38047726bfec8e1aULL, 0xa67738b4cd3b45aaULL,
989 0xad16691cec0dde19ULL, 0xc6d4319380462e07ULL,
990 0xc5a5876d0ba61938ULL, 0x16b9fa1fa58fd840ULL,
991 0x188ab1173ca74f18ULL, 0xabda2f98c99c021fULL,
992 0x3e0580ab134ae816ULL, 0x5f3b05b773645abbULL,
993 0x2501a2be5575f2f6ULL, 0x1b2f74004e7e8ba9ULL,
994 0x1cd7580371e8d953ULL, 0x7f6ed89562764e30ULL,
995 0xb15926ff596f003dULL, 0x9f65293da8c5d6b9ULL,
996 0x6ecef04dd690f84cULL, 0x4782275fff33af88ULL,
997 0xe41433083f820801ULL, 0xfd0dfe409a1af9b5ULL,
998 0x4325a3342cdb396bULL, 0x8ae77e62b301b252ULL,
999 0xc36f9e9f6655615aULL, 0x85455a2d92d32c09ULL,
1000 0xf2c7dea949477485ULL, 0x63cfb4c133a39ebaULL,
1001 0x83b040cc6ebc5462ULL, 0x3b9454c8fdb326b0ULL,
1002 0x56f56a9e87ffd78cULL, 0x2dc2940d99f42bc6ULL,
1003 0x98f7df096b096e2dULL, 0x19a6e01e3ad852bfULL,
1004 0x42a99ccbdbd4b40bULL, 0xa59998af45e9c559ULL,
1005 0x366295e807d93186ULL, 0x6b48181bfaa1f773ULL,
1006 0x1fec57e2157a0a1dULL, 0x4667446af6201ad5ULL,
1007 0xe615ebcacfb0f075ULL, 0xb8f31f4f68290778ULL,
1008 0x22713ed6ce22d11eULL, 0x3057c1a72ec3c93bULL,
1009 0xcb46acc37c3f1f2fULL, 0xdbb893fd02aaf50eULL,
1010 0x331fd92e600b9fcfULL, 0xa498f96148ea3ad6ULL,
1011 0xa8d8426e8b6a83eaULL, 0xa089b274b7735cdcULL,
1012 0x87f6b3731e524a11ULL, 0x118808e5cbc96749ULL,
1013 0x9906e4c7b19bd394ULL, 0xafed7f7e9b24a20cULL,
1014 0x6509eadeeb3644a7ULL, 0x6c1ef1d3e8ef0edeULL,
1015 0xb9c97d43e9798fb4ULL, 0xa2f2d784740c28a3ULL,
1016 0x7b8496476197566fULL, 0x7a5be3e6b65f069dULL,
1017 0xf96330ed78be6f10ULL, 0xeee60de77a076a15ULL,
1018 0x2b4bee4aa08b9bd0ULL, 0x6a56a63ec7b8894eULL,
1019 0x02121359ba34fef4ULL, 0x4cbf99f8283703fcULL,
1020 0x398071350caf30c8ULL, 0xd0a77a89f017687aULL,
1021 0xf1c1a9eb9e423569ULL, 0x8c7976282dee8199ULL,
1022 0x5d1737a5dd1f7abdULL, 0x4f53433c09a9fa80ULL,
1023 0xfa8b0c53df7ca1d9ULL, 0x3fd9dcbc886ccb77ULL,
1024 0xc040917ca91b4720ULL, 0x7dd00142f9d1dcdfULL,
1025 0x8476fc1d4f387b58ULL, 0x23f8e7c5f3316503ULL,
1026 0x032a2244e7e37339ULL, 0x5c87a5d750f5a74bULL,
1027 0x082b4cc43698992eULL, 0xdf917becb858f63cULL,
1028 0x3270b8fc5bf86ddaULL, 0x10ae72bb29b5dd76ULL,
1029 0x576ac94e7700362bULL, 0x1ad112dac61efb8fULL,
1030 0x691bc30ec5faa427ULL, 0xff246311cc327143ULL,
1031 0x3142368e30e53206ULL, 0x71380e31e02ca396ULL,
1032 0x958d5c960aad76f1ULL, 0xf8d6f430c16da536ULL,
1033 0xc8ffd13f1be7e1d2ULL, 0x7578ae66004ddbe1ULL,
1034 0x05833f01067be646ULL, 0xbb34b5ad3bfe586dULL,
1035 0x095f34c9a12b97f0ULL, 0x247ab64525d60ca8ULL,
1036 0xdcdbc6f3017477d1ULL, 0x4a2e14d4decad24dULL,
1037 0xbdb5e6d9be0a1eebULL, 0x2a7e70f7794301abULL,
1038 0xdef42d8a270540fdULL, 0x01078ec0a34c22c1ULL,
1039 0xe5de511af4c16387ULL, 0x7ebb3a52bd9a330aULL,
1040 0x77697857aa7d6435ULL, 0x004e831603ae4c32ULL,
1041 0xe7a21020ad78e312ULL, 0x9d41a70c6ab420f2ULL,
1042 0x28e06c18ea1141e6ULL, 0xd2b28cbd984f6b28ULL,
1043 0x26b75f6c446e9d83ULL, 0xba47568c4d418d7fULL,
1044 0xd80badbfe6183d8eULL, 0x0e206d7f5f166044ULL,
1045 0xe258a43911cbca3eULL, 0x723a1746b21dc0bcULL,
1046 0xc7caa854f5d7cdd3ULL, 0x7cac32883d261d9cULL,
1047 0x7690c26423ba942cULL, 0x17e55524478042b8ULL,
1048 0xe0be477656a2389fULL, 0x4d289b5e67ab2da0ULL,
1049 0x44862b9c8fbbfd31ULL, 0xb47cc8049d141365ULL,
1050 0x822c1b362b91c793ULL, 0x4eb14655fb13dfd8ULL,
1051 0x1ecbba0714e2a97bULL, 0x6143459d5cde5f14ULL,
1052 0x53a8fbf1d5f0ac89ULL, 0x97ea04d81c5e5b00ULL,
1053 0x622181a8d4fdb3f3ULL, 0xe9bcd341572a1208ULL,
1054 0x1411258643cce58aULL, 0x9144c5fea4c6e0a4ULL,
1055 0x0d33d06565cf620fULL, 0x54a48d489f219ca1ULL,
1056 0xc43e5eac6d63c821ULL, 0xa9728b3a72770dafULL,
1057 0xd7934e7b20df87efULL, 0xe35503b61a3e86e5ULL,
1058 0xcae321fbc819d504ULL, 0x129a50b3ac60bfa6ULL,
1059 0xcd5e68ea7e9fb6c3ULL, 0xb01c90199483b1c7ULL,
1060 0x3de93cd5c295376cULL, 0xaed52edf2ab9ad13ULL,
1061 0x2e60f512c0a07884ULL, 0xbc3d86a3e36210c9ULL,
1062 0x35269d9b163951ceULL, 0x0c7d6e2ad0cdb5faULL,
1063 0x59e86297d87f5733ULL, 0x298ef221898db0e7ULL,
1064 0x55000029d1a5aa7eULL, 0x8bc08ae1b5061b45ULL,
1065 0xc2c31c2b6c92703aULL, 0x94cc596baf25ef42ULL,
1066 0x0a1d73db22540456ULL, 0x04b6a0f9d9c4179aULL,
1067 0xeffdafa2ae3d3c60ULL, 0xf7c8075bb49496c4ULL,
1068 0x9cc5c7141d1cd4e3ULL, 0x78bd1638218e5534ULL,
1069 0xb2f11568f850246aULL, 0xedfabcfa9502bc29ULL,
1070 0x796ce5f2da23051bULL, 0xaae128b0dc93537cULL,
1071 0x3a493da0ee4b29aeULL, 0xb5df6b2c416895d7ULL,
1072 0xfcabbd25122d7f37ULL, 0x70810b58105dc4b1ULL,
1073 0xe10fdd37f7882a90ULL, 0x524dcab5518a3f5cULL,
1074 0x3c9e85878451255bULL, 0x4029828119bd34e2ULL,
1075 0x74a05b6f5d3ceccbULL, 0xb610021542e13ecaULL,
1076 0x0ff979d12f59e2acULL, 0x6037da27e4f9cc50ULL,
1077 0x5e92975a0df1847dULL, 0xd66de190d3e623feULL,
1078 0x5032d6b87b568048ULL, 0x9a36b7ce8235216eULL,
1079 0x80272a7a24f64b4aULL, 0x93efed8b8c6916f7ULL,
1080 0x37ddbff44cce1555ULL, 0x4b95db5d4b99bd25ULL,
1081 0x92d3fda169812fc0ULL, 0xfb1a4a9a90660bb6ULL,
1082 0x730c196946a4b9b2ULL, 0x81e289aa7f49da68ULL,
1083 0x64669a0f83b1a05fULL, 0x27b3ff7d9644f48bULL,
1084 0xcc6b615c8db675b3ULL, 0x674f20b9bcebbe95ULL,
1085 0x6f31238275655982ULL, 0x5ae488713e45cf05ULL,
1086 0xbf619f9954c21157ULL, 0xeabac46040a8eae9ULL,
1087 0x454c6fe9f2c0c1cdULL, 0x419cf6496412691cULL,
1088 0xd3dc3bef265b0f70ULL, 0x6d0e60f5c3578a9eULL,
1089 0x5b0e608526323c55ULL, 0x1a46c1a9fa1b59f5ULL,
1090 0xa9e245a17c4c8ffaULL, 0x65ca5159db2955d7ULL,
1091 0x05db0a76ce35afc2ULL, 0x81eac77ea9113d45ULL,
1092 0x528ef88ab6ac0a0dULL, 0xa09ea253597be3ffULL,
1093 0x430ddfb3ac48cd56ULL, 0xc4b3a67af45ce46fULL,
1094 0x4ececfd8fbe2d05eULL, 0x3ef56f10b39935f0ULL,
1095 0x0b22d6829cd619c6ULL, 0x17fd460a74df2069ULL,
1096 0x6cf8cc8e8510ed40ULL, 0xd6c824bf3a6ecaa7ULL,
1097 0x61243d581a817049ULL, 0x048bacb6bbc163a2ULL,
1098 0xd9a38ac27d44cc32ULL, 0x7fddff5baaf410abULL,
1099 0xad6d495aa804824bULL, 0xe1a6a74f2d8c9f94ULL,
1100 0xd4f7851235dee8e3ULL, 0xfd4b7f886540d893ULL,
1101 0x247c20042aa4bfdaULL, 0x096ea1c517d1327cULL,
1102 0xd56966b4361a6685ULL, 0x277da5c31221057dULL,
1103 0x94d59893a43acff7ULL, 0x64f0c51ccdc02281ULL,
1104 0x3d33bcc4ff6189dbULL, 0xe005cb184ce66af1ULL,
1105 0xff5ccd1d1db99beaULL, 0xb0b854a7fe42980fULL,
1106 0x7bd46a6a718d4b9fULL, 0xd10fa8cc22a5fd8cULL,
1107 0xd31484952be4bd31ULL, 0xc7fa975fcb243847ULL,
1108 0x4886ed1e5846c407ULL, 0x28cddb791eb70b04ULL,
1109 0xc2b00be2f573417fULL, 0x5c9590452180f877ULL,
1110 0x7a6bddfff370eb00ULL, 0xce509e38d6d9d6a4ULL,
1111 0xebeb0f00647fa702ULL, 0x1dcc06cf76606f06ULL,
1112 0xe4d9f28ba286ff0aULL, 0xd85a305dc918c262ULL,
1113 0x475b1d8732225f54ULL, 0x2d4fb51668ccb5feULL,
1114 0xa679b9d9d72bba20ULL, 0x53841c0d912d43a5ULL,
1115 0x3b7eaa48bf12a4e8ULL, 0x781e0e47f22f1ddfULL,
1116 0xeff20ce60ab50973ULL, 0x20d261d19dffb742ULL,
1117 0x16a12b03062a2e39ULL, 0x1960eb2239650495ULL,
1118 0x251c16fed50eb8b8ULL, 0x9ac0c330f826016eULL,
1119 0xed152665953e7671ULL, 0x02d63194a6369570ULL,
1120 0x5074f08394b1c987ULL, 0x70ba598c90b25ce1ULL,
1121 0x794a15810b9742f6ULL, 0x0d5925e9fcaf8c6cULL,
1122 0x3067716cd868744eULL, 0x910ab077e8d7731bULL,
1123 0x6a61bbdb5ac42f61ULL, 0x93513efbf0851567ULL,
1124 0xf494724b9e83e9d5ULL, 0xe887e1985c09648dULL,
1125 0x34b1d3c675370cfdULL, 0xdc35e433bc0d255dULL,
1126 0xd0aab84234131be0ULL, 0x08042a50b48b7eafULL,
1127 0x9997c4ee44a3ab35ULL, 0x829a7b49201799d0ULL,
1128 0x263b8307b7c54441ULL, 0x752f95f4fd6a6ca6ULL,
1129 0x927217402c08c6e5ULL, 0x2a8ab754a795d9eeULL,
1130 0xa442f7552f72943dULL, 0x2c31334e19781208ULL,
1131 0x4fa98d7ceaee6291ULL, 0x55c3862f665db309ULL,
1132 0xbd0610175d53b1f3ULL, 0x46fe6cb840413f27ULL,
1133 0x3fe03792df0cfa59ULL, 0xcfe700372eb85e8fULL,
1134 0xa7be29e7adbce118ULL, 0xe544ee5cde8431ddULL,
1135 0x8a781b1b41f1873eULL, 0xa5c94c78a0d2f0e7ULL,
1136 0x39412e2877b60728ULL, 0xa1265ef3afc9a62cULL,
1137 0xbcc2770c6a2506c5ULL, 0x3ab66dd5dce1ce12ULL,
1138 0xe65499d04a675b37ULL, 0x7d8f523481bfd216ULL,
1139 0x0f6f64fcec15f389ULL, 0x74efbe618b5b13c8ULL,
1140 0xacdc82b714273e1dULL, 0xdd40bfe003199d17ULL,
1141 0x37e99257e7e061f8ULL, 0xfa52626904775aaaULL,
1142 0x8bbbf63a463d56f9ULL, 0xf0013f1543a26e64ULL,
1143 0xa8307e9f879ec898ULL, 0xcc4c27a4150177ccULL,
1144 0x1b432f2cca1d3348ULL, 0xde1d1f8f9f6fa013ULL,
1145 0x606602a047a7ddd6ULL, 0xd237ab64cc1cb2c7ULL,
1146 0x9b938e7225fcd1d3ULL, 0xec4e03708e0ff476ULL,
1147 0xfeb2fbda3d03c12dULL, 0xae0bced2ee43889aULL,
1148 0x22cb8923ebfb4f43ULL, 0x69360d013cf7396dULL,
1149 0x855e3602d2d4e022ULL, 0x073805bad01f784cULL,
1150 0x33e17a133852f546ULL, 0xdf4874058ac7b638ULL,
1151 0xba92b29c678aa14aULL, 0x0ce89fc76cfaadcdULL,
1152 0x5f9d4e0908339e34ULL, 0xf1afe9291f5923b9ULL,
1153 0x6e3480f60f4a265fULL, 0xeebf3a2ab29b841cULL,
1154 0xe21938a88f91b4adULL, 0x57dfeff845c6d3c3ULL,
1155 0x2f006b0bf62caaf2ULL, 0x62f479ef6f75ee78ULL,
1156 0x11a55ad41c8916a9ULL, 0xf229d29084fed453ULL,
1157 0x42f1c27b16b000e6ULL, 0x2b1f76749823c074ULL,
1158 0x4b76eca3c2745360ULL, 0x8c98f463b91691bdULL,
1159 0x14bcc93cf1ade66aULL, 0x8885213e6d458397ULL,
1160 0x8e177df0274d4711ULL, 0xb49b73b5503f2951ULL,
1161 0x10168168c3f96b6bULL, 0x0e3d963b63cab0aeULL,
1162 0x8dfc4b5655a1db14ULL, 0xf789f1356e14de5cULL,
1163 0x683e68af4e51dac1ULL, 0xc9a84f9d8d4b0fd9ULL,
1164 0x3691e03f52a0f9d1ULL, 0x5ed86e46e1878e80ULL,
1165 0x3c711a0e99d07150ULL, 0x5a0865b20c4e9310ULL,
1166 0x56fbfc1fe4f0682eULL, 0xea8d5de3105edf9bULL,
1167 0x71abfdb12379187aULL, 0x2eb99de1bee77b9cULL,
1168 0x21ecc0ea33cf4523ULL, 0x59a4d7521805c7a1ULL,
1169 0x3896f5eb56ae7c72ULL, 0xaa638f3db18f75dcULL,
1170 0x9f39358dabe9808eULL, 0xb7defa91c00b72acULL,
1171 0x6b5541fd62492d92ULL, 0x6dc6dee8f92e4d5bULL,
1172 0x353f57abc4beea7eULL, 0x735769d6da5690ceULL,
1173 0x0a234aa642391484ULL, 0xf6f9508028f80d9dULL,
1174 0xb8e319a27ab3f215ULL, 0x31ad9c1151341a4dULL,
1175 0x773c22a57bef5805ULL, 0x45c7561a07968633ULL,
1176 0xf913da9e249dbe36ULL, 0xda652d9b78a64c68ULL,
1177 0x4c27a97f3bc334efULL, 0x76621220e66b17f4ULL,
1178 0x967743899acd7d0bULL, 0xf3ee5bcae0ed6782ULL,
1179 0x409f753600c879fcULL, 0x06d09a39b5926db6ULL,
1180 0x6f83aeb0317ac588ULL, 0x01e6ca4a86381f21ULL,
1181 0x66ff3462d19f3025ULL, 0x72207c24ddfd3bfbULL,
1182 0x4af6b6d3e2ece2ebULL, 0x9c994dbec7ea08deULL,
1183 0x49ace597b09a8bc4ULL, 0xb38c4766cf0797baULL,
1184 0x131b9373c57c2a75ULL, 0xb1822cce61931e58ULL,
1185 0x9d7555b909ba1c0cULL, 0x127fafdd937d11d2ULL,
1186 0x29da3badc66d92e4ULL, 0xa2c1d57154c2ecbcULL,
1187 0x58c5134d82f6fe24ULL, 0x1c3ae3515b62274fULL,
1188 0xe907c82e01cb8126ULL, 0xf8ed091913e37fcbULL,
1189 0x3249d8f9c80046c9ULL, 0x80cf9bede388fb63ULL,
1190 0x1881539a116cf19eULL, 0x5103f3f76bd52457ULL,
1191 0x15b7e6f5ae47f7a8ULL, 0xdbd7c6ded47e9ccfULL,
1192 0x44e55c410228bb1aULL, 0xb647d4255edb4e99ULL,
1193 0x5d11882bb8aafc30ULL, 0xf5098bbb29d3212aULL,
1194 0x8fb5ea14e90296b3ULL, 0x677b942157dd025aULL,
1195 0xfb58e7c0a390acb5ULL, 0x89d3674c83bd4a01ULL,
1196 0x9e2da4df4bf3b93bULL, 0xfcc41e328cab4829ULL,
1197 0x03f38c96ba582c52ULL, 0xcad1bdbd7fd85db2ULL,
1198 0xbbb442c16082ae83ULL, 0xb95fe86ba5da9ab0ULL,
1199 0xb22e04673771a93fULL, 0x845358c9493152d8ULL,
1200 0xbe2a488697b4541eULL, 0x95a2dc2dd38e6966ULL,
1201 0xc02c11ac923c852bULL, 0x2388b1990df2a87bULL,
1202 0x7c8008fa1b4f37beULL, 0x1f70d0c84d54e503ULL,
1203 0x5490adec7ece57d4ULL, 0x002b3c27d9063a3aULL,
1204 0x7eaea3848030a2bfULL, 0xc602326ded2003c0ULL,
1205 0x83a7287d69a94086ULL, 0xc57a5fcb30f57a8aULL,
1206 0xb56844e479ebe779ULL, 0xa373b40f05dcbce9ULL,
1207 0xd71a786e88570ee2ULL, 0x879cbacdbde8f6a0ULL,
1208 0x976ad1bcc164a32fULL, 0xab21e25e9666d78bULL,
1209 0x901063aae5e5c33cULL, 0x9818b34448698d90ULL,
1210 0xe36487ae3e1e8abbULL, 0xafbdf931893bdcb4ULL,
1211 0x6345a0dc5fbbd519ULL, 0x8628fe269b9465caULL,
1212 0x1e5d01603f9c51ecULL, 0x4de44006a15049b7ULL,
1213 0xbf6c70e5f776cbb1ULL, 0x411218f2ef552bedULL,
1214 0xcb0c0708705a36a3ULL, 0xe74d14754f986044ULL,
1215 0xcd56d9430ea8280eULL, 0xc12591d7535f5065ULL,
1216 0xc83223f1720aef96ULL, 0xc3a0396f7363a51fULL
1217};