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