/[public]/psiconv/trunk/lib/psiconv/checkuid.c
ViewVC logotype

Contents of /psiconv/trunk/lib/psiconv/checkuid.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 112 - (show annotations)
Sun Mar 11 16:23:17 2001 UTC (23 years ago) by frodo
File MIME type: text/plain
File size: 6418 byte(s)
(Frodo) Gert-Jan de Vos' patch for checkuid

1 /*
2 checkuid.c - Part of psiconv, a PSION 5 file formats converter
3 Copyright (c) 1999, 2000 Frodo Looijaard <frodol@dds.nl>
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., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20 #include "config.h"
21 #include "compat.h"
22 #include "common.h"
23
24 static psiconv_u32 uid1[32] =
25 { /* bit 0 */ 0x000045A0,
26 /* bit 1 */ 0x00008B40,
27 /* bit 2 */ 0x000006A1,
28 /* bit 3 */ 0x00000D42,
29 /* bit 4 */ 0x00001A84,
30 /* bit 5 */ 0x00003508,
31 /* bit 6 */ 0x00006A10,
32 /* bit 7 */ 0x0000D420,
33 /* bit 8 */ 0x45A00000,
34 /* bit 9 */ 0x8B400000,
35 /* bit 10 */ 0x06A10000,
36 /* bit 11 */ 0x0D420000,
37 /* bit 12 */ 0x1A840000,
38 /* bit 13 */ 0x35080000,
39 /* bit 14 */ 0x6A100000,
40 /* bit 15 */ 0xD4200000,
41 /* bit 16 */ 0x0000AA51,
42 /* bit 17 */ 0x00004483,
43 /* bit 18 */ 0x00008906,
44 /* bit 19 */ 0x0000022D,
45 /* bit 20 */ 0x0000045A,
46 /* bit 21 */ 0x000008B4,
47 /* bit 22 */ 0x00001168,
48 /* bit 23 */ 0x000022D0,
49 /* bit 24 */ 0xAA510000,
50 /* bit 25 */ 0x44830000,
51 /* bit 26 */ 0x89060000,
52 /* bit 27 */ 0x022D0000,
53 /* bit 28 */ 0x045A0000,
54 /* bit 29 */ 0x08B40000,
55 /* bit 30 */ 0x11680000,
56 /* bit 31 */ 0x22D00000};
57
58 static psiconv_u32 uid2[32] =
59 { /* bit 0 */ 0x000076B4,
60 /* bit 1 */ 0x0000ED68,
61 /* bit 2 */ 0x0000CAF1,
62 /* bit 3 */ 0x000085C3,
63 /* bit 4 */ 0x00001BA7,
64 /* bit 5 */ 0x0000374E,
65 /* bit 6 */ 0x00006E9C,
66 /* bit 7 */ 0x0000DD38,
67 /* bit 8 */ 0x76B40000,
68 /* bit 9 */ 0xED680000,
69 /* bit 10 */ 0xCAF10000,
70 /* bit 11 */ 0x85C30000,
71 /* bit 12 */ 0x1BA70000,
72 /* bit 13 */ 0x374E0000,
73 /* bit 14 */ 0x6E9C0000,
74 /* bit 15 */ 0xDD380000,
75 /* bit 16 */ 0x00003730,
76 /* bit 17 */ 0x00006E60,
77 /* bit 18 */ 0x0000DCC0,
78 /* bit 19 */ 0x0000A9A1,
79 /* bit 20 */ 0x00004363,
80 /* bit 21 */ 0x000086C6,
81 /* bit 22 */ 0x00001DAD,
82 /* bit 23 */ 0x00003B5A,
83 /* bit 24 */ 0x37300000,
84 /* bit 25 */ 0x6E600000,
85 /* bit 26 */ 0xDCC00000,
86 /* bit 27 */ 0xA9A10000,
87 /* bit 28 */ 0x43630000,
88 /* bit 29 */ 0x86C60000,
89 /* bit 30 */ 0x1DAD0000,
90 /* bit 31 */ 0x3B5A0000 };
91
92 static psiconv_u32 uid3[32] =
93 { /* bit 0 */ 0x00003331,
94 /* bit 1 */ 0x00006662,
95 /* bit 2 */ 0x0000CCC4,
96 /* bit 3 */ 0x000089A9,
97 /* bit 4 */ 0x00000373,
98 /* bit 5 */ 0x000006E6,
99 /* bit 6 */ 0x00000DCC,
100 /* bit 7 */ 0x00001B98,
101 /* bit 8 */ 0x33310000,
102 /* bit 9 */ 0x66620000,
103 /* bit 10 */ 0xCCC40000,
104 /* bit 11 */ 0x89A90000,
105 /* bit 12 */ 0x03730000,
106 /* bit 13 */ 0x06E60000,
107 /* bit 14 */ 0x0DCC0000,
108 /* bit 15 */ 0x1B980000,
109 /* bit 16 */ 0x00001021,
110 /* bit 17 */ 0x00002042,
111 /* bit 18 */ 0x00004084,
112 /* bit 19 */ 0x00008108,
113 /* bit 20 */ 0x00001231,
114 /* bit 21 */ 0x00002462,
115 /* bit 22 */ 0x000048C4,
116 /* bit 23 */ 0x00009188,
117 /* bit 24 */ 0x10210000,
118 /* bit 25 */ 0x20420000,
119 /* bit 26 */ 0x40840000,
120 /* bit 27 */ 0x81080000,
121 /* bit 28 */ 0x12310000,
122 /* bit 29 */ 0x24620000,
123 /* bit 30 */ 0x48C40000,
124 /* bit 31 */ 0x91880000 };
125
126
127 psiconv_u32 psiconv_checkuid(psiconv_u32 id1,psiconv_u32 id2,psiconv_u32 id3)
128 {
129 psiconv_u32 i;
130 psiconv_u32 res = 0;
131 for (i = 0; i < 32; i++) {
132 if (id1 & (1 << i))
133 res = res ^ uid1[i];
134 if (id2 & (1 << i))
135 res = res ^ uid2[i];
136 if (id3 & (1 << i))
137 res = res ^ uid3[i];
138 }
139 return res;
140 }

frodo@frodo.looijaard.name
ViewVC Help
Powered by ViewVC 1.1.26