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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 351 - (hide annotations)
Wed Oct 22 19:53:40 2014 UTC (9 years, 5 months ago) by frodo
File MIME type: text/plain
File size: 6474 byte(s)
(Frodo) Update copyright year in all source files

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

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