?? tea.cod
字號:
000be 85 c9 test ecx, ecx
000c0 74 27 je SHORT $L16735
; 105 : {
; 106 : BYTE& a_b = ((BYTE*)key128)[a_validCharacters & 0xF];
000c2 8b 45 fc mov eax, DWORD PTR _a_validCharacters$[ebp]
000c5 8b 5d 08 mov ebx, DWORD PTR _key128$[ebp]
000c8 83 e0 0f and eax, 15 ; 0000000fH
000cb 03 c3 add eax, ebx
; 107 : a_b = (a_b << 1) ^ (a_b >> 1) ^ (BYTE)(p - a_set);
000cd bb 00 00 00 00 mov ebx, OFFSET FLAT:??_C@_0CH@JKEA@?5_0123456789abcdefghijklmnopqrst@ ; `string'
000d2 2a cb sub cl, bl
000d4 8a 10 mov dl, BYTE PTR [eax]
000d6 8a da mov bl, dl
000d8 d0 eb shr bl, 1
000da 32 cb xor cl, bl
000dc d0 e2 shl dl, 1
000de 32 ca xor cl, dl
000e0 88 08 mov BYTE PTR [eax], cl
; 108 : a_validCharacters++;
000e2 8b 45 fc mov eax, DWORD PTR _a_validCharacters$[ebp]
000e5 40 inc eax
000e6 89 45 fc mov DWORD PTR _a_validCharacters$[ebp], eax
$L16735:
000e9 8b 45 10 mov eax, DWORD PTR _pLen$[ebp]
000ec 46 inc esi
000ed 3b f0 cmp esi, eax
000ef 0f 8c 4c ff ff
ff jl $L16853
; 109 : }
; 110 : }
; 111 :
; 112 : return a_validCharacters;
000f5 8b 45 fc mov eax, DWORD PTR _a_validCharacters$[ebp]
000f8 5b pop ebx
$L16736:
000f9 5f pop edi
000fa 5e pop esi
; 113 : }
000fb 8b e5 mov esp, ebp
000fd 5d pop ebp
000fe c3 ret 0
?GetKeyFromPhrase@@YAHPAXPBDH@Z ENDP ; GetKeyFromPhrase
_TEXT ENDS
PUBLIC ?EncryptData_TEA@@YA_NPBXHPBD@Z ; EncryptData_TEA
; COMDAT ?EncryptData_TEA@@YA_NPBXHPBD@Z
_TEXT SEGMENT
_src$ = 8
_n$ = 12
_szPass$ = 16
_i$ = -4
_key$ = -28
_a_buf$16772 = -12
?EncryptData_TEA@@YA_NPBXHPBD@Z PROC NEAR ; EncryptData_TEA, COMDAT
; 116 : {
00000 55 push ebp
00001 8b ec mov ebp, esp
00003 83 ec 1c sub esp, 28 ; 0000001cH
; 117 : void * dst = (void*)src;
; 118 : int i = 0;
; 119 :
; 120 : if (!szPass || !*szPass) // no change for empty string
00006 8b 45 10 mov eax, DWORD PTR _szPass$[ebp]
00009 53 push ebx
0000a 33 db xor ebx, ebx
0000c 3b c3 cmp eax, ebx
0000e 0f 84 5f 01 00
00 je $L16763
00014 38 18 cmp BYTE PTR [eax], bl
00016 0f 84 57 01 00
00 je $L16763
; 122 :
; 123 : BYTE key[16]; // 128 bit key
; 124 :
; 125 : if (!GetKeyFromPhrase(key, szPass))
0001c 6a ff push -1
0001e 50 push eax
0001f 8d 45 e4 lea eax, DWORD PTR _key$[ebp]
00022 50 push eax
00023 e8 00 00 00 00 call ?GetKeyFromPhrase@@YAHPAXPBDH@Z ; GetKeyFromPhrase
00028 83 c4 0c add esp, 12 ; 0000000cH
0002b 85 c0 test eax, eax
; 126 : return false;
0002d 0f 84 40 01 00
00 je $L16763
; 127 :
; 128 : for (i = 0; i < (n >> 3); i++)
00033 8b 45 0c mov eax, DWORD PTR _n$[ebp]
00036 56 push esi
00037 57 push edi
00038 33 ff xor edi, edi
0003a c1 f8 03 sar eax, 3
0003d 3b c3 cmp eax, ebx
0003f 89 7d fc mov DWORD PTR _i$[ebp], edi
00042 89 45 f8 mov DWORD PTR -8+[ebp], eax
00045 7e 7d jle SHORT $L16768
00047 8b 75 08 mov esi, DWORD PTR _src$[ebp]
0004a eb 02 jmp SHORT $L16766
$L16900:
0004c 33 db xor ebx, ebx
$L16766:
; 129 : {
; 130 : // we pass chunk number as aux value to XOR with data (to avoid revealing repetition)
; 131 : EncipherChunk_TEA(((const BYTE*)src) + (i << 3), ((BYTE*)dst) + (i << 3), key, i);
0004e 8b 56 04 mov edx, DWORD PTR [esi+4]
00051 8b c7 mov eax, edi
00053 8b 3e mov edi, DWORD PTR [esi]
00055 33 c9 xor ecx, ecx
00057 33 c7 xor eax, edi
00059 c7 45 10 20 00
00 00 mov DWORD PTR 16+[ebp], 32 ; 00000020H
$L16867:
00060 8b fa mov edi, edx
00062 8b da mov ebx, edx
00064 c1 ef 05 shr edi, 5
00067 c1 e3 04 shl ebx, 4
0006a 33 fb xor edi, ebx
0006c 8b d9 mov ebx, ecx
0006e 83 e3 03 and ebx, 3
00071 03 fa add edi, edx
00073 8b 5c 9d e4 mov ebx, DWORD PTR _key$[ebp+ebx*4]
00077 03 d9 add ebx, ecx
00079 81 e9 47 86 c8
61 sub ecx, 1640531527 ; 61c88647H
0007f 33 fb xor edi, ebx
00081 03 c7 add eax, edi
00083 8b f8 mov edi, eax
00085 8b d8 mov ebx, eax
00087 c1 ef 05 shr edi, 5
0008a c1 e3 04 shl ebx, 4
0008d 33 fb xor edi, ebx
0008f 8b d9 mov ebx, ecx
00091 c1 eb 0b shr ebx, 11 ; 0000000bH
00094 83 e3 03 and ebx, 3
00097 03 f8 add edi, eax
00099 8b 5c 9d e4 mov ebx, DWORD PTR _key$[ebp+ebx*4]
0009d 03 d9 add ebx, ecx
0009f 33 fb xor edi, ebx
000a1 03 d7 add edx, edi
000a3 8b 7d 10 mov edi, DWORD PTR 16+[ebp]
000a6 4f dec edi
000a7 89 7d 10 mov DWORD PTR 16+[ebp], edi
000aa 75 b4 jne SHORT $L16867
000ac 8b 7d fc mov edi, DWORD PTR _i$[ebp]
000af 89 06 mov DWORD PTR [esi], eax
000b1 8b 45 f8 mov eax, DWORD PTR -8+[ebp]
000b4 89 56 04 mov DWORD PTR [esi+4], edx
000b7 47 inc edi
000b8 83 c6 08 add esi, 8
000bb 3b f8 cmp edi, eax
000bd 89 7d fc mov DWORD PTR _i$[ebp], edi
000c0 7c 8a jl SHORT $L16900
; 127 :
; 128 : for (i = 0; i < (n >> 3); i++)
000c2 33 db xor ebx, ebx
$L16768:
; 132 : }
; 133 :
; 134 : if (n & 0x7) // have we got left over bytes? we must pad it out to 8 bytes
000c4 8b 45 0c mov eax, DWORD PTR _n$[ebp]
000c7 83 e0 07 and eax, 7
000ca 89 45 10 mov DWORD PTR 16+[ebp], eax
000cd 0f 84 97 00 00
00 je $L16889
; 135 : {
; 136 : BYTE a_buf[8] = {0,0,0,0,0,0,0,0};
000d3 88 5d f4 mov BYTE PTR _a_buf$16772[ebp], bl
000d6 88 5d f5 mov BYTE PTR _a_buf$16772[ebp+1], bl
000d9 88 5d f6 mov BYTE PTR _a_buf$16772[ebp+2], bl
000dc 88 5d f7 mov BYTE PTR _a_buf$16772[ebp+3], bl
; 137 : EncipherChunk_TEA(a_buf, a_buf, key); // is this dangerous?
000df 8b 4d f4 mov ecx, DWORD PTR _a_buf$16772[ebp]
000e2 88 5d f8 mov BYTE PTR _a_buf$16772[ebp+4], bl
000e5 88 5d f9 mov BYTE PTR _a_buf$16772[ebp+5], bl
000e8 88 5d fa mov BYTE PTR _a_buf$16772[ebp+6], bl
000eb 88 5d fb mov BYTE PTR _a_buf$16772[ebp+7], bl
000ee 8b 55 f8 mov edx, DWORD PTR _a_buf$16772[ebp+4]
000f1 33 c0 xor eax, eax
000f3 c7 45 0c 20 00
00 00 mov DWORD PTR 12+[ebp], 32 ; 00000020H
$L16880:
000fa 8b f2 mov esi, edx
000fc 8b da mov ebx, edx
000fe c1 ee 05 shr esi, 5
00101 c1 e3 04 shl ebx, 4
00104 33 f3 xor esi, ebx
00106 8b d8 mov ebx, eax
00108 83 e3 03 and ebx, 3
0010b 03 f2 add esi, edx
0010d 8b 5c 9d e4 mov ebx, DWORD PTR _key$[ebp+ebx*4]
00111 03 d8 add ebx, eax
00113 2d 47 86 c8 61 sub eax, 1640531527 ; 61c88647H
00118 33 f3 xor esi, ebx
0011a 03 ce add ecx, esi
0011c 8b f1 mov esi, ecx
0011e 8b d9 mov ebx, ecx
00120 c1 ee 05 shr esi, 5
00123 c1 e3 04 shl ebx, 4
00126 33 f3 xor esi, ebx
00128 8b d8 mov ebx, eax
0012a c1 eb 0b shr ebx, 11 ; 0000000bH
0012d 83 e3 03 and ebx, 3
00130 03 f1 add esi, ecx
00132 8b 5c 9d e4 mov ebx, DWORD PTR _key$[ebp+ebx*4]
00136 03 d8 add ebx, eax
00138 33 f3 xor esi, ebx
0013a 03 d6 add edx, esi
0013c 8b 75 0c mov esi, DWORD PTR 12+[ebp]
0013f 4e dec esi
00140 89 75 0c mov DWORD PTR 12+[ebp], esi
00143 75 b5 jne SHORT $L16880
; 138 : MemcpyXor(((BYTE*)dst) + (i << 3), a_buf, n & 0x7);
00145 8b 75 10 mov esi, DWORD PTR 16+[ebp]
00148 89 4d f4 mov DWORD PTR _a_buf$16772[ebp], ecx
0014b 8b 4d 08 mov ecx, DWORD PTR _src$[ebp]
0014e 89 55 f8 mov DWORD PTR _a_buf$16772[ebp+4], edx
00151 85 f6 test esi, esi
00153 8d 04 f9 lea eax, DWORD PTR [ecx+edi*8]
00156 7e 12 jle SHORT $L16889
00158 8d 4d f4 lea ecx, DWORD PTR _a_buf$16772[ebp]
0015b 2b c8 sub ecx, eax
$L16887:
0015d 8a 14 01 mov dl, BYTE PTR [ecx+eax]
00160 8a 18 mov bl, BYTE PTR [eax]
00162 32 da xor bl, dl
00164 88 18 mov BYTE PTR [eax], bl
00166 40 inc eax
00167 4e dec esi
00168 75 f3 jne SHORT $L16887
$L16889:
0016a 5f pop edi
0016b 5e pop esi
; 139 : }
; 140 :
; 141 : return true;
0016c b0 01 mov al, 1
0016e 5b pop ebx
; 142 : }
0016f 8b e5 mov esp, ebp
00171 5d pop ebp
00172 c3 ret 0
$L16763:
; 121 : return false;
00173 32 c0 xor al, al
00175 5b pop ebx
; 142 : }
00176 8b e5 mov esp, ebp
00178 5d pop ebp
00179 c3 ret 0
?EncryptData_TEA@@YA_NPBXHPBD@Z ENDP ; EncryptData_TEA
_TEXT ENDS
PUBLIC ?DecryptData_TEA@@YA_NPBXHPBD@Z ; DecryptData_TEA
; COMDAT ?DecryptData_TEA@@YA_NPBXHPBD@Z
_TEXT SEGMENT
_src$ = 8
_n$ = 12
_szPass$ = 16
_i$ = -4
_key$ = -28
_a_buf$16792 = -12
?DecryptData_TEA@@YA_NPBXHPBD@Z PROC NEAR ; DecryptData_TEA, COMDAT
; 145 : {
00000 55 push ebp
00001 8b ec mov ebp, esp
00003 83 ec 1c sub esp, 28 ; 0000001cH
; 146 : void * dst = (void*)src;
; 147 : int i = 0;
; 148 :
; 149 : if (!szPass || !*szPass) // no change for empty string
00006 8b 45 10 mov eax, DWORD PTR _szPass$[ebp]
00009 53 push ebx
0000a 33 db xor ebx, ebx
0000c 3b c3 cmp eax, ebx
0000e 0f 84 5c 01 00
00 je $L16783
00014 38 18 cmp BYTE PTR [eax], bl
00016 0f 84 54 01 00
00 je $L16783
; 151 :
; 152 : BYTE key[16]; // 128 bit key
; 153 :
; 154 : if (!GetKeyFromPhrase(key, szPass))
0001c 6a ff push -1
0001e 50 push eax
0001f 8d 45 e4 lea eax, DWORD PTR _key$[ebp]
00022 50 push eax
00023 e8 00 00 00 00 call ?GetKeyFromPhrase@@YAHPAXPBDH@Z ; GetKeyFromPhrase
00028 83 c4 0c add esp, 12 ; 0000000cH
0002b 85 c0 test eax, eax
; 155 : return false;
0002d 0f 84 3d 01 00
00 je $L16783
; 156 :
; 157 : for (i = 0; i < (n >> 3); i++)
00033 8b 45 0c mov eax, DWORD PTR _n$[ebp]
00036 56 push esi
00037 57 push edi
00038 33 ff xor edi, edi
0003a c1 f8 03 sar eax, 3
0003d 3b c3 cmp eax, ebx
0003f 89 7d fc mov DWORD PTR _i$[ebp], edi
00042 89 45 f8 mov DWORD PTR -8+[ebp], eax
00045 7e 7a jle SHORT $L16788
00047 8b 75 08 mov esi, DWORD PTR _src$[ebp]
$L16786:
; 158 : {
; 159 : // we pass chunk number as aux value to XOR with data (to avoid revealing repetition)
; 160 : DecipherChunk_TEA(((const BYTE*)src) + (i << 3), ((BYTE*)dst) + (i << 3), key, i);
0004a 8b 06 mov eax, DWORD PTR [esi]
0004c 8b 56 04 mov edx, DWORD PTR [esi+4]
0004f b9 20 37 ef c6 mov ecx, -957401312 ; c6ef3720H
00054 c7 45 10 20 00
00 00 mov DWORD PTR 16+[ebp], 32 ; 00000020H
$L16912:
0005b 8b f8 mov edi, eax
0005d 8b d8 mov ebx, eax
0005f c1 ef 05 shr edi, 5
00062 c1 e3 04 shl ebx, 4
00065 33 fb xor edi, ebx
00067 8b d9 mov ebx, ecx
00069 c1 eb 0b shr ebx, 11 ; 0000000bH
0006c 83 e3 03 and ebx, 3
0006f 03 f8 add edi, eax
00071 8b 5c 9d e4 mov ebx, DWORD PTR _key$[ebp+ebx*4]
00075 03 d9 add ebx, ecx
00077 81 c1 47 86 c8
61 add ecx, 1640531527 ; 61c88647H
0007d 33 fb xor edi, ebx
0007f 2b d7 sub edx, edi
00081 8b fa mov edi, edx
00083 8b da mov ebx, edx
00085 c1 ef 05 shr edi, 5
00088 c1 e3 04 shl ebx, 4
0008b 33 fb xor edi, ebx
0008d 8b d9 mov ebx, ecx
0008f 83 e3 03 and ebx, 3
00092 03 fa add edi, edx
00094 8b 5c 9d e4 mov ebx, DWORD PTR _key$[ebp+ebx*4]
00098 03 d9 add ebx, ecx
0009a 33 fb xor edi, ebx
0009c 2b c7 sub eax, edi
0009e 8b 7d 10 mov edi, DWORD PTR 16+[ebp]
000a1 4f dec edi
000a2 89 7d 10 mov DWORD PTR 16+[ebp], edi
000a5 75 b4 jne SHORT $L16912
000a7 8b 7d fc mov edi, DWORD PTR _i$[ebp]
000aa 89 56 04 mov DWORD PTR [esi+4], edx
000ad 33 c7 xor eax, edi
000af 47 inc edi
000b0 89 06 mov DWORD PTR [esi], eax
000b2 8b 45 f8 mov eax, DWORD PTR -8+[ebp]
000b5 83 c6 08 add esi, 8
000b8 3b f8 cmp edi, eax
000ba 89 7d fc mov DWORD PTR _i$[ebp], edi
000bd 7c 8b jl SHORT $L16786
; 156 :
; 157 : for (i = 0; i < (n >> 3); i++)
000bf 33 db xor ebx, ebx
$L16788:
; 161 : }
; 162 :
; 163 : if (n & 0x7) // have we got left over bytes?
000c1 8b 45 0c mov eax, DWORD PTR _n$[ebp]
000c4 83 e0 07 and eax, 7
000c7 89 45 10 mov DWORD PTR 16+[ebp], eax
000ca 0f 84 97 00 00
00 je $L16934
; 164 : {
; 165 : BYTE a_buf[8] = {0,0,0,0,0,0,0,0};
000d0 88 5d f4 mov BYTE PTR _a_buf$16792[ebp], bl
000d3 88 5d f5 mov BYTE PTR _a_buf$16792[ebp+1], bl
000d6 88 5d f6 mov BYTE PTR _a_buf$16792[ebp+2], bl
000d9 88 5d f7 mov BYTE PTR _a_buf$16792[ebp+3], bl
; 166 : EncipherChunk_TEA(a_buf, a_buf, key); // is this dangerous?
000dc 8b 4d f4 mov ecx, DWORD PTR _a_buf$16792[ebp]
000df 88 5d f8 mov BYTE PTR _a_buf$16792[ebp+4], bl
000e2 88 5d f9 mov BYTE PTR _a_buf$16792[ebp+5], bl
000e5 88 5d fa mov BYTE PTR _a_buf$16792[ebp+6], bl
000e8 88 5d fb mov BYTE PTR _a_buf$16792[ebp+7], bl
000eb 8b 55 f8 mov edx, DWORD PTR _a_buf$16792[ebp+4]
000ee 33 c0 xor eax, eax
000f0 c7 45 0c 20 00
00 00 mov DWORD PTR 12+[ebp], 32 ; 00000020H
$L16925:
000f7 8b f2 mov esi, edx
000f9 8b da mov ebx, edx
000fb c1 ee 05 shr esi, 5
000fe c1 e3 04 shl ebx, 4
00101 33 f3 xor esi, ebx
00103 8b d8 mov ebx, eax
00105 83 e3 03 and ebx, 3
00108 03 f2 add esi, edx
0010a 8b 5c 9d e4 mov ebx, DWORD PTR _key$[ebp+ebx*4]
0010e 03 d8 add ebx, eax
00110 2d 47 86 c8 61 sub eax, 1640531527 ; 61c88647H
00115 33 f3 xor esi, ebx
00117 03 ce add ecx, esi
00119 8b f1 mov esi, ecx
0011b 8b d9 mov ebx, ecx
0011d c1 ee 05 shr esi, 5
00120 c1 e3 04 shl ebx, 4
00123 33 f3 xor esi, ebx
00125 8b d8 mov ebx, eax
00127 c1 eb 0b shr ebx, 11 ; 0000000bH
0012a 83 e3 03 and ebx, 3
0012d 03 f1 add esi, ecx
0012f 8b 5c 9d e4 mov ebx, DWORD PTR _key$[ebp+ebx*4]
00133 03 d8 add ebx, eax
00135 33 f3 xor esi, ebx
00137 03 d6 add edx, esi
00139 8b 75 0c mov esi, DWORD PTR 12+[ebp]
0013c 4e dec esi
0013d 89 75 0c mov DWORD PTR 12+[ebp], esi
00140 75 b5 jne SHORT $L16925
; 167 : MemcpyXor(((BYTE*)dst) + (i << 3), a_buf, n & 0x7);
00142 8b 75 10 mov esi, DWORD PTR 16+[ebp]
00145 89 4d f4 mov DWORD PTR _a_buf$16792[ebp], ecx
00148 8b 4d 08 mov ecx, DWORD PTR _src$[ebp]
0014b 89 55 f8 mov DWORD PTR _a_buf$16792[ebp+4], edx
0014e 85 f6 test esi, esi
00150 8d 04 f9 lea eax, DWORD PTR [ecx+edi*8]
00153 7e 12 jle SHORT $L16934
00155 8d 4d f4 lea ecx, DWORD PTR _a_buf$16792[ebp]
00158 2b c8 sub ecx, eax
$L16932:
0015a 8a 14 01 mov dl, BYTE PTR [ecx+eax]
0015d 8a 18 mov bl, BYTE PTR [eax]
0015f 32 da xor bl, dl
00161 88 18 mov BYTE PTR [eax], bl
00163 40 inc eax
00164 4e dec esi
00165 75 f3 jne SHORT $L16932
$L16934:
00167 5f pop edi
00168 5e pop esi
; 168 : }
; 169 :
; 170 : return true;
00169 b0 01 mov al, 1
0016b 5b pop ebx
; 171 : }
0016c 8b e5 mov esp, ebp
0016e 5d pop ebp
0016f c3 ret 0
$L16783:
; 150 : return false;
00170 32 c0 xor al, al
00172 5b pop ebx
; 171 : }
00173 8b e5 mov esp, ebp
00175 5d pop ebp
00176 c3 ret 0
?DecryptData_TEA@@YA_NPBXHPBD@Z ENDP ; DecryptData_TEA
_TEXT ENDS
END
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -