第二段代码就容易多了,可能我已经习惯了,哈哈哈哈哈

但是这个函数是用EBX作为返回值的,不合逻辑,正常返回应该是用EAX

 

004013D8    33C0            XOR EAX,EAX
004013DA    33FF            XOR EDI,EDI
004013DC    33DB            XOR EBX,EBX
004013DE    8B7424 04       MOV ESI,DWORD PTR SS:[ESP+4]
004013E2    B0 0A           MOV AL,0A
004013E4    8A1E            MOV BL,BYTE PTR DS:[ESI]
004013E6    84DB            TEST BL,BL
004013E8    74 0B           JE SHORT serial.004013F5
004013EA    80EB 30         SUB BL,30
004013ED    0FAFF8          IMUL EDI,EAX
004013F0    03FB            ADD EDI,EBX
004013F2    46              INC ESI
004013F3  ^ EB ED           JMP SHORT serial.004013E2
004013F5    81F7 34120000   XOR EDI,1234
004013FB    8BDF            MOV EBX,EDI
004013FD    C3              RETN

 

int fun2(char *str)
{
 char *temp = str;
 int j = 0;
 for( int i = 0 ; ; i++ )
 {
  if( temp == '\0' )
  {
   break;
  }
  temp -= 0x30;
  j = ( j * 10 ) + (int)temp ;
 }
 j = j ^ 0x1234;
 return j;
}

 

posted @ 2014-10-20 16:09  穷到底  阅读(138)  评论(1编辑  收藏  举报