// // DES_ede3_cbc_encrypt from 0x87eae8 to 0x87f0f4 (1548 bytes) // // 4 xrefs: // > sub_8000B8 @ 0x800170 // > sub_8000B8 @ 0x8001f0 // > sub_800924 @ 0x8009b0 // > @ 0x631dc // // This function is hookable on this platform! // // Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA // Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings // unsigned int __fastcall DES_ede3_cbc_encrypt( unsigned __int8 *a1, unsigned __int8 *a2, int a3, _DWORD *a4, _DWORD *a5, _DWORD *a6, unsigned __int8 *a7, int a8) { _BYTE *v9; // r10 int v10; // r6 unsigned int v11; // r3 unsigned int v12; // r0 unsigned __int8 *v13; // r5 _BYTE *v14; // r4 int v15; // lr __int16 v16; // kr00_2 int v17; // r2 unsigned __int8 *v18; // r2 int v19; // r9 int v20; // r8 unsigned __int8 *v21; // r7 int v22; // r10 _BYTE *v23; // r6 unsigned int v24; // r5 int v25; // r4 int v26; // r8 __int16 v27; // r3^2 unsigned int v28; // r2 int v29; // r2 int v30; // r6 int v31; // r7 int v32; // r4 int v33; // r5 unsigned __int8 *v34; // r3 unsigned __int8 *v35; // r2 unsigned __int8 *v36; // r1 unsigned int result; // r0 unsigned __int8 v38; // r12 unsigned __int8 v39; // r5 unsigned int v40; // lr unsigned __int8 v41; // r4 unsigned __int8 v42; // r1 unsigned __int8 v43; // r2 unsigned int v44; // r3 int v45; // r1 int v46; // r1 int v47; // r12 int v48; // r1 int v49; // r12 int v50; // r12 int v51; // r1 int v52; // r1 int v53; // lr int v54; // r1 int v55; // lr int v56; // r1 int v57; // lr unsigned __int8 *v58; // [sp+8h] [bp-1Ch] unsigned __int8 *v59; // [sp+Ch] [bp-18h] unsigned int v61; // [sp+14h] [bp-10h] unsigned int v62; // [sp+14h] [bp-10h] unsigned int v63; // [sp+18h] [bp-Ch] BYREF unsigned int v64; // [sp+1Ch] [bp-8h] v58 = a1; v59 = a2; v9 = a7; if ( a8 ) { v10 = a3 - 8; v61 = a3 - 8; v11 = (a7[6] << 16) | (a7[5] << 8) | a7[4] | (a7[7] << 24); v12 = (a7[2] << 16) | (a7[1] << 8) | *a7 | (a7[3] << 24); if ( a3 - 8 >= 0 ) { v13 = v58 + 8; v14 = a2 + 8; do { v15 = ((*(v13 - 6) << 16) | (*(v13 - 7) << 8) | *(v13 - 8) | (*(v13 - 5) << 24)) ^ v12; v64 = v11 ^ ((*(v13 - 2) << 16) | (*(v13 - 3) << 8) | *(v13 - 4) | (*(v13 - 1) << 24)); v63 = v15; DES_encrypt3((int *)&v63, a4, a5, a6); v12 = v63; v11 = v64; v16 = HIWORD(v63); *(v14 - 7) = BYTE1(v63); *((_WORD *)v14 - 3) = v16; v10 -= 8; *(v14 - 8) = v12; *((_DWORD *)v14 - 1) = v11; v13 += 8; v14 += 8; } while ( v10 >= 0 ); v10 = a3 - 16 - 8 * (v61 >> 3); v17 = 8 * ((v61 >> 3) + 1); v58 += v17; v59 += v17; } if ( v10 == -8 ) { v38 = BYTE2(v12); v39 = v12; v40 = HIBYTE(v12); v41 = BYTE1(v12); result = (unsigned __int8)v11; v42 = BYTE1(v11); v43 = BYTE2(v11); v44 = HIBYTE(v11); } else { v18 = &v58[v10 + 8]; switch ( v10 ) { case -7: v50 = 0; v56 = 0; goto LABEL_30; case -6: v50 = 0; v54 = 0; goto LABEL_29; case -5: v50 = 0; v52 = 0; goto LABEL_28; case -4: v50 = 0; goto LABEL_27; case -3: v48 = 0; goto LABEL_26; case -2: v46 = 0; goto LABEL_25; case -1: v45 = *--v18; v46 = v45 << 16; LABEL_25: v47 = *--v18; v48 = v46 | (v47 << 8); LABEL_26: v49 = *--v18; v50 = v49 | v48; LABEL_27: v51 = *--v18; v52 = v51 << 24; LABEL_28: v53 = *--v18; v54 = v52 | (v53 << 16); LABEL_29: v55 = *--v18; v56 = v54 | (v55 << 8); LABEL_30: v57 = *(v18 - 1) | v56; break; default: v50 = 0; v57 = 0; break; } v63 = v57 ^ v12; v64 = v50 ^ v11; DES_encrypt3((int *)&v63, a4, a5, a6); v39 = v63; result = (unsigned __int8)v64; v41 = BYTE1(v63); v38 = BYTE2(v63); v42 = BYTE1(v64); v43 = BYTE2(v64); v40 = HIBYTE(v63); v44 = HIBYTE(v64); v59[1] = BYTE1(v63); v59[2] = v38; v59[5] = v42; v59[6] = v43; *v59 = v39; v59[3] = v40; v59[4] = result; v59[7] = v44; } *a7 = v39; a7[1] = v41; a7[2] = v38; a7[3] = v40; a7[4] = result; a7[5] = v42; a7[6] = v43; a7[7] = v44; } else { v19 = a3 - 8; v20 = (a7[2] << 16) | (a7[1] << 8) | *a7 | (a7[3] << 24); v62 = a3 - 8; if ( a3 - 8 < 0 ) { v25 = (a7[6] << 16) | (a7[5] << 8) | a7[4] | (a7[7] << 24); v24 = (a7[2] << 16) | (a7[1] << 8) | *a7 | (a7[3] << 24); } else { v21 = a1 + 8; v22 = (a7[6] << 16) | (a7[5] << 8) | a7[4] | (a7[7] << 24); v23 = a2 + 8; do { v25 = (*(v21 - 2) << 16) | (*(v21 - 3) << 8) | *(v21 - 4) | (*(v21 - 1) << 24); v63 = (*(v21 - 6) << 16) | (*(v21 - 7) << 8) | *(v21 - 8) | (*(v21 - 5) << 24); v24 = v63; v64 = v25; DES_decrypt3((int *)&v63, a4, a5, a6); v26 = v20 ^ v63; v27 = HIWORD(v64) ^ HIWORD(v22); v28 = (v64 ^ v22) >> 8; *(v23 - 4) = v64 ^ v22; *((_DWORD *)v23 - 2) = v26; v19 -= 8; *(v23 - 3) = v28; *((_WORD *)v23 - 1) = v27; v21 += 8; v20 = v24; v22 = v25; v23 += 8; } while ( v19 >= 0 ); v19 = a3 - 16 - 8 * (v62 >> 3); v29 = 8 * ((v62 >> 3) + 1); v58 += v29; v9 = a7; v59 += v29; } if ( v19 != -8 ) { v30 = (v58[2] << 16) | (v58[1] << 8) | *v58 | (v58[3] << 24); v31 = (v58[6] << 16) | (v58[5] << 8) | v58[4] | (v58[7] << 24); v63 = v30; v64 = v31; DES_decrypt3((int *)&v63, a4, a5, a6); v32 = v25 ^ v64; v33 = v24 ^ v63; v34 = &v59[v19 + 8]; switch ( v19 ) { case -7: goto LABEL_20; case -6: goto LABEL_19; case -5: v36 = &v59[v19 + 8]; goto LABEL_18; case -4: goto LABEL_17; case -3: v35 = &v59[v19 + 8]; goto LABEL_16; case -2: goto LABEL_15; case -1: *--v34 = BYTE2(v32); LABEL_15: *(v34 - 1) = BYTE1(v32); v35 = v34 - 1; LABEL_16: v34 = v35 - 1; *(v35 - 1) = v32; LABEL_17: v36 = v34 - 1; *(v34 - 1) = HIBYTE(v33); LABEL_18: v34 = v36 - 1; *(v36 - 1) = BYTE2(v33); LABEL_19: *--v34 = BYTE1(v33); LABEL_20: *(v34 - 1) = v33; v25 = v31; v24 = v30; break; default: v25 = v31; v24 = v30; break; } } *v9 = v24; v9[4] = v25; v9[1] = BYTE1(v24); v9[2] = BYTE2(v24); v9[3] = HIBYTE(v24); v9[5] = BYTE1(v25); v9[6] = BYTE2(v25); v9[7] = HIBYTE(v25); return HIBYTE(v24); } return result; }
GD Web Decomp Icon

GD Web Decomp

Raw Source