📄 desmain.lst
字号:
224 3 BitMap[3]&=~0x80;BitMap[4]&=~0x20;
225 3 }
226 2 if(A&0x01)BitMap[4]|=0x10;else BitMap[4]&=~0x10;
227 2
228 2 // memcpy(BitMap,"\x9c\x2d\x8e\xdd\xae\xae\x72\xe5",8);
229 2 A=CalcArea[2];
230 2 if(A&0x80)BitMap[0]|=0x02;else BitMap[0]&=~0x02;
231 2 if(A&0x40)BitMap[5]|=0x80;else BitMap[5]&=~0x80;
232 2 if(A&0x20)BitMap[0]|=0x80;else BitMap[0]&=~0x80;
233 2 if(A&0x10)BitMap[4]|=0x40;else BitMap[4]&=~0x40;
234 2 if(A&0x08)BitMap[1]|=0x80;else BitMap[1]&=~0x80;
235 2 if(A&0x04)BitMap[6]|=0x04;else BitMap[6]&=~0x04;
236 2 if(A&0x02)BitMap[1]|=0x04;else BitMap[1]&=~0x04;
237 2 if(A&0x01)BitMap[4]|=0x08;else BitMap[4]&=~0x08;
238 2
239 2 // memcpy(BitMap,"\x1c\x2d\x8e\xdd\xe6\x2e\x76\xe5",8);
240 2 A=CalcArea[3];
241 2 if(A&0x40)BitMap[6]|=0x80;else BitMap[6]&=~0x80;
C51 COMPILER V6.10 DESMAIN 09/19/2002 15:12:12 PAGE 5
242 2 if(A&0x10)BitMap[7]|=0x08;else BitMap[7]&=~0x08;
243 2 if(A&0x08)BitMap[0]|=0x01;else BitMap[0]&=~0x01;
244 2 if(A&0x02)BitMap[2]|=0x02;else BitMap[2]&=~0x02;
245 2 if(A&0x01)BitMap[6]|=0x02;else BitMap[6]&=~0x02;
246 2
247 2 // memcpy(BitMap,"\x1c\x2d\x8c\xdd\xe6\x2e\x76\xe5",8);
248 2 A=CalcArea[4];
249 2 if(A&0x80)BitMap[2]|=0x04;else BitMap[2]&=~0x04;
250 2 if(A&0x40)BitMap[7]|=0x10;else BitMap[7]&=~0x10;
251 2 if(A&0x20)BitMap[2]|=0x80;else BitMap[2]&=~0x80;
252 2 if(A&0x08)BitMap[2]|=0x01;else BitMap[2]&=~0x01;
253 2 if(A&0x04)BitMap[7]|=0x20;else BitMap[7]&=~0x20;
254 2 if(A&0x02)BitMap[0]|=0x08;else BitMap[0]&=~0x08;
255 2 if(A&0x01)BitMap[7]|=0x40;else BitMap[7]&=~0x40;
256 2 // memcpy(BitMap,"\x14\x2d\x09\xdd\xe6\x2e\x76\xa5",8);
257 2 A=CalcArea[5];
258 2 if(A&0x80)BitMap[3]|=0x10;else BitMap[3]&=~0x10;
259 2 if(A&0x40)BitMap[5]|=0x10;else BitMap[5]&=~0x10;
260 2 if(A&0x20)BitMap[3]|=0x20;else BitMap[3]&=~0x20;
261 2 if(A&0x10)BitMap[6]|=0x40;else BitMap[6]&=~0x40;
262 2 if(A&0x08)BitMap[3]|=0x40;else BitMap[3]&=~0x40;
263 2 if(A&0x04)BitMap[4]|=0x02;else BitMap[4]&=~0x02;
264 2 if(A&0x02)BitMap[1]|=0x20;else BitMap[1]&=~0x20;
265 2 if(A&0x01)BitMap[5]|=0x04;else BitMap[5]&=~0x04;
266 2 // memcpy(BitMap,"\x14\x0d\x09\xed\xe6\x2e\x76\xa5",8);
267 2 A=CalcArea[6];
268 2 if(A&0x80)BitMap[1]|=0x08;else BitMap[1]&=~0x08;
269 2 if(A&0x40)BitMap[4]|=0x80;else BitMap[4]&=~0x80;
270 2 if(A&0x20)BitMap[1]|=0x40;else BitMap[1]&=~0x40;
271 2 if(A&0x10)BitMap[5]|=0x20;else BitMap[5]&=~0x20;
272 2 if(A&0x08)BitMap[0]|=0x40;else BitMap[0]&=~0x40;
273 2 if(A&0x02)BitMap[3]|=0x08;else BitMap[3]&=~0x08;
274 2 if(A&0x01)BitMap[4]|=0x01;else BitMap[4]&=~0x01;
275 2 // memcpy(BitMap,"\x14\x0d\x09\xe5\x66\x2e\x76\xa5",8);
276 2 if(!(mode&0x30)) //!(Decode~, BuildMac)//DecShift2
277 2 {
278 3 B--;
279 3 for( R6=( B && (R3!=0) )?2:1; R6!=0; R6--)
280 3 {
281 4 ptr1=CalcArea;
282 4 A=(*ptr1);
283 4 ptr1++;
284 4 for(R4=6;R4!=0;R4--,ptr1++)
285 4 {
286 5 tmp=A;
287 5 A=(*ptr1);
288 5 (*ptr1)=tmp;
289 5 }
290 4 CalcArea[0]=(A<<2)+(A>>6);
291 4 }
292 3 }
293 2 //InitExpand://ExpXorSBox:
294 2 for(R4=4,ptr0=BitMap,A=(*ptr2),ptr2+=3;R4!=0;R4--,ptr2--)
295 2 {
296 3 A=(A&0xf0)+((*ptr2)&0x0f);
297 3 A^=(*ptr0);
298 3 A=(A>>4)+(A<<4);
299 3 A&=0xfc;
300 3 (*ptr0)=SBoxes[4-R4+A];
301 3 ptr0++;
302 3
303 3 A=(*ptr2);
C51 COMPILER V6.10 DESMAIN 09/19/2002 15:12:12 PAGE 6
304 3 A^=(*ptr0);
305 3 A&=0xfc;
306 3 (*ptr0)=SBoxes[4-R4+A];
307 3 ptr0++;
308 3 A=(*ptr2);
309 3 }
310 2
311 2 if(!(R3&0x01))ptr2+=8;//Odd Round?
312 2 A>>=1;
313 2 if(BitMap[1]&0x40)A|=0x80;else A&=~0x80;
314 2 A>>=1;
315 2 if(BitMap[4]&0x08)A|=0x80;else A&=~0x80;
316 2 A>>=1;
317 2 if(BitMap[5]&0x10)A|=0x80;else A&=~0x80;
318 2 A>>=1;
319 2 if(BitMap[7]&0x10)A|=0x80;else A&=~0x80;
320 2 A>>=1;
321 2 if(BitMap[2]&0x08)A|=0x80;else A&=~0x80;
322 2 A>>=1;
323 2 if(BitMap[6]&0x08)A|=0x80;else A&=~0x80;
324 2 A>>=1;
325 2 if(BitMap[4]&0x01)A|=0x80;else A&=~0x80;
326 2 A>>=1;
327 2 if(BitMap[0]&0x01)A|=0x80;else A&=~0x80;
328 2 (*ptr2)^=A;
329 2
330 2 A>>=1;
331 2 if(BitMap[3]&0x40)A|=0x80;else A&=~0x80;
332 2 A>>=1;
333 2 if(BitMap[5]&0x40)A|=0x80;else A&=~0x80;
334 2 A>>=1;
335 2 if(BitMap[6]&0x02)A|=0x80;else A&=~0x80;
336 2 A>>=1;
337 2 if(BitMap[1]&0x10)A|=0x80;else A&=~0x80;
338 2 A>>=1;
339 2 if(BitMap[4]&0x02)A|=0x80;else A&=~0x80;
340 2 A>>=1;
341 2 if(BitMap[7]&0x40)A|=0x80;else A&=~0x80;
342 2 A>>=1;
343 2 if(BitMap[2]&0x02)A|=0x80;else A&=~0x80;
344 2 A>>=1;
345 2 if(BitMap[0]&0x02)A|=0x80;else A&=~0x80;
346 2 ptr2--;
347 2 (*ptr2)^=A;
348 2
349 2 A>>=1;
350 2 if(BitMap[1]&0x80)A|=0x80;else A&=~0x80;
351 2 A>>=1;
352 2 if(BitMap[5]&0x80)A|=0x80;else A&=~0x80;
353 2 A>>=1;
354 2 if(BitMap[3]&0x20)A|=0x80;else A&=~0x80;
355 2 A>>=1;
356 2 if(BitMap[7]&0x80)A|=0x80;else A&=~0x80;
357 2 A>>=1;
358 2 if(BitMap[6]&0x04)A|=0x80;else A&=~0x80;
359 2 A>>=1;
360 2 if(BitMap[0]&0x04)A|=0x80;else A&=~0x80;
361 2 A>>=1;
362 2 if(BitMap[2]&0x01)A|=0x80;else A&=~0x80;
363 2 A>>=1;
364 2 if(BitMap[4]&0x04)A|=0x80;else A&=~0x80;
365 2 ptr2--;
C51 COMPILER V6.10 DESMAIN 09/19/2002 15:12:12 PAGE 7
366 2 (*ptr2)^=A;
367 2
368 2 A>>=1;
369 2 if(BitMap[3]&0x10)A|=0x80;else A&=~0x80;
370 2 A>>=1;
371 2 if(BitMap[7]&0x20)A|=0x80;else A&=~0x80;
372 2 A>>=1;
373 2 if(BitMap[1]&0x20)A|=0x80;else A&=~0x80;
374 2 A>>=1;
375 2 if(BitMap[5]&0x20)A|=0x80;else A&=~0x80;
376 2 A>>=1;
377 2 if(BitMap[2]&0x04)A|=0x80;else A&=~0x80;
378 2 A>>=1;
379 2 if(BitMap[0]&0x08)A|=0x80;else A&=~0x80;
380 2 A>>=1;
381 2 if(BitMap[6]&0x01)A|=0x80;else A&=~0x80;
382 2 A>>=1;
383 2 if(BitMap[3]&0x80)A|=0x80;else A&=~0x80;
384 2 ptr2--;
385 2 (*ptr2)^=A;
386 2 }
387 1 // Normalize output of 16 rounds
388 1 //PreOutput:
389 1 BitMap[7]=(*ptr2);
390 1 ptr2++;
391 1 BitMap[5]=(*ptr2);
392 1 ptr2++;
393 1 BitMap[3]=(*ptr2);
394 1 ptr2++;
395 1 BitMap[1]=(*ptr2);
396 1 ptr2++;
397 1 BitMap[6]=(*ptr2);
398 1 ptr2++;
399 1 BitMap[4]=(*ptr2);
400 1 ptr2++;
401 1 BitMap[2]=(*ptr2);
402 1 ptr2++;
403 1 BitMap[0]=(*ptr2);
404 1
405 1 //InvItPerm:
406 1 for(R3=8,ptr0=BitMap;R3!=0;R3--,ptr0++)
407 1 {
408 2 A=(*ptr0);
409 2 A=(A<<1)+(A>>7);
410 2 for(R4=8;R4!=0;R4--)
411 2 {
412 3 (*ptr2)<<=1;
413 3 if(A&0x01)(*ptr2)|=0x01;else (*ptr2)&=~0x01;
414 3 A>>=1;
415 3 ptr2--;
416 3 }
417 2 ptr2+=8;
418 2 }
419 1 tmp=(*ptr2);
420 1 (*ptr2)=(tmp>>2)+(tmp<<6);
421 1 //Result of DES operation available
422 1 for(R3=8;R3!=0;R3--)
423 1 text[R3-1]=CalcArea[R3+7];
424 1 return 0; //Normal Termination => Carry == 0 !
425 1 }
426 void main(void)
427 {
C51 COMPILER V6.10 DESMAIN 09/19/2002 15:12:12 PAGE 8
428 1 char xdata key[8] = {0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef};
429 1 char data sour[8] = {0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef};
430 1 char data dest[8] = {0xA2,0xD9,0x39,0x16,0x5D,0x26,0xA4,0xCA};
431 1
432 1 memcpy(dest,sour,8);
433 1 DES(0, dest, key);
434 1 DES(0x20,dest,key);
435 1 while (1);
436 1 }
437
438
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 3202 ----
CONSTANT SIZE = 280 ----
XDATA SIZE = ---- 47
PDATA SIZE = ---- ----
DATA SIZE = ---- 16
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -