• Source
    1. #include <stdio.h>
    2. #include <string.h>
    3.  
    4. typedef unsigned long DWORD;
    5. typedef unsigned short WORD;
    6. typedef unsigned char BYTE;
    7. #define LOWORD(l) ((WORD)(l))
    8. #define HIWORD(l) ((WORD)(((DWORD)(l) >> 16) & 0xFFFF))
    9. #define LOBYTE(w) ((BYTE)(w))
    10. #define HIBYTE(w) ((BYTE)(((WORD)(w) >> 8) & 0xFF))
    11. int shl(unsigned long int a, int n);
    12. int shl(unsigned long int a, int n) {
    13.  
    14. return (a << n);
    15.  
    16. }
    17. int main() {
    18. int edi = 0x00000000;
    19. int ebx = 0x00000000;
    20. int ecx = 0x00000000;
    21. int esi = 0x00000000;
    22. int edx = 0x00000000;
    23. int eax = 0x00000000;
    24. char str [] = "12";
    25. do {
    26. int eax = str[ecx];
    27. eax = eax + esi;
    28. edx = eax%0xFF;//idiv
    29. eax = eax/0xFF;//idiv
    30. edi = LOWORD(edx);
    31. esi = LOWORD(edi);
    32. eax = LOWORD(ebx);
    33. eax = eax + esi;
    34. edx = eax%0xFF;//idiv
    35. eax = eax/0XFF;//idiv
    36. ebx = LOWORD(edx);
    37. ecx++;
    38. }while(ecx < strlen(str));
    39. eax = LOWORD(ebx);
    40. eax = shl(eax,8);
    41. eax = eax | edi;
    42. printf("%X",eax);
    43. }
    44.