一种加密算法

  1. int __cdecl DecryptionFunction2(const char *aText, int a2, const char *a3, int a4, int a5, int boolEncryptUSecurity)

  2. {

  3. int v6; // ebx@1

  4. const char *aCipherText; // ebp@1

  5. int counter; // edi@1

  6. const char *v9; // esi@1

  7. size_t expectedResultSize2; // ebx@6

  8. void *resultString; // esi@6

  9. int intCounter; // ebp@7

  10. unsigned int charAlphabetIndexes; // ebx@8

  11. signed int bitIndex; // esi@8

  12. unsigned int v16; // eax@2

  13. void *v17; // esi@2

  14. unsigned int aCipherLength; // eax@6

  15. unsigned int aCipherLength2; // ebp@6

  16. int expectedResultSize; // ecx@6

  17. void *tempResultString; // eax@6

  18. unsigned int charAlphabetIndexShifted; // eax@9

  19. int v23; // eax@10

  20. int v24; // ecx@10

  21. unsigned int v25; // ebx@10

  22. void *Base64String; // [sp+14h] [bp-E8h]@1

  23. unsigned int v27; // [sp+ECh] [bp-10h]@1

  24. const char *aCipherText2; // [sp+34h] [bp-C8h]@1

  25. int v29; // [sp+30h] [bp-CCh]@1

  26. void *v30; // [sp+3Ch] [bp-C0h]@1

  27. int (__thiscall **v31)(void *, char); // [sp+38h] [bp-C4h]@1

  28. int v32; // [sp+F8h] [bp-4h]@1

  29. int expectedResultSize3; // [sp+28h] [bp-D4h]@6

  30. void *tempResultString2; // [sp+20h] [bp-DCh]@6

  31. int ciperLengthMinus5; // [sp+1Ch] [bp-E0h]@6

  32. int v36; // [sp+2Ch] [bp-D0h]@7

  33. int v37; // [sp+24h] [bp-D8h]@7

  34. int v38; // [sp+18h] [bp-E4h]@7

  35.   v27 = (unsigned int)&Base64String ^ dword_1024FB2C;

  36.   aCipherText = aText;

  37.   v9 = a3;

  38.   counter = 0;

  39.   aCipherText2 = aText;

  40.   v29 = a2;

  41.   v30 = 0;

  42.   v31 = &off_101B0F4C;

  43.   v32 = 0;

  44.   v6 = a4;

  45.   sub_1011C310(a3, strlen(a3), a4);

  46. if ( a5 )

  47. {

  48.     v16 = sub_1011CE20(v9, strlen(v9), &Base64String);

  49.     v17 = Base64String;

  50.     sub_1011C310(Base64String, v16, v6);

  51.     j__free(v17);

  52. }

  53. if ( boolEncryptUSecurity )

  54.     Base64String = USecurityAlphabet;

  55. else

  56.     Base64String = Base64Alphabet;

  57.   aCipherLength = strlen(aCipherText);

  58.   aCipherLength2 = aCipherLength;

  59.   expectedResultSize = ((unsigned __int64)(715827883i64 * (signed int)aCipherLength) >> 32)

  60. + ((unsigned int)((unsigned __int64)(715827883i64 * (signed int)aCipherLength) >> 32) >> 31);

  61.   expectedResultSize2 = 4 * expectedResultSize + 1;

  62.   expectedResultSize3 = 4 * expectedResultSize + 1;

  63.   tempResultString = operator new(4 * expectedResultSize + 1);

  64.   resultString = tempResultString;

  65.   tempResultString2 = tempResultString;

  66. memset(tempResultString, 0, expectedResultSize2);

  67. *((_BYTE *)resultString + expectedResultSize2 - 1) = 0;

  68.   ciperLengthMinus5 = aCipherLength2 - 5;

  69. if ( (signed int)(aCipherLength2 - 5) > 0 )

  70. {

  71.     intCounter = (int)(resultString + 2);

  72.     v36 = resultString - ((char *)resultString - 1);

  73.     v37 = resultString - ((char *)resultString - 1) - 2;

  74.     v38 = resultString - ((char *)resultString - 1) - 3;

  75. do

  76. {

  77.       charAlphabetIndexes = 0;

  78.       bitIndex = 0;

  79. do

  80. {

  81.         charAlphabetIndexShifted = (strchr((const char *)Base64String, aCipherText2[counter]) - Base64String) <&lt; bitIndex;

  82.         bitIndex += 6;

  83. ++counter;

  84.         charAlphabetIndexes += charAlphabetIndexShifted;

  85. }

  86. while ( bitIndex &lt; 36 );

  87.       v23 = v37;

  88.       v24 = v38;

  89. *(_BYTE *)(v36 + intCounter) = charAlphabetIndexes;

  90.       v25 = charAlphabetIndexes >&gt; 8;

  91. *(_BYTE *)intCounter = v25;

  92.       v25 &gt;&gt;= 8;

  93. *(_BYTE *)(v23 + intCounter) = v25;

  94. *(_BYTE *)(v24 + intCounter) = BYTE1(v25);

  95.       intCounter += 4;

  96. }

  97. while ( counter < ciperLengthMinus5 );

  98.     resultString = tempResultString2;

  99.     expectedResultSize2 = expectedResultSize3;

  100. }

  101. *(_BYTE *)(*(_DWORD *)v29 + sub_1011CDB0(resultString, expectedResultSize2, v29) - 1) = 0;

  102.   j_j__free(resultString);

  103.   v31 = &off_101B0F30;

  104.   j_j__free(v30);

  105. return sub_10151C4E();

int __cdecl DecryptionFunction2(const char *aText, int a2, const char *a3, int a4, int a5, int boolEncryptUSecurity)
{
  int v6; // ebx@1
  const char *aCipherText; // ebp@1
  int counter; // edi@1
  const char *v9; // esi@1
  size_t expectedResultSize2; // ebx@6
  void *resultString; // esi@6
  int intCounter; // ebp@7
  unsigned int charAlphabetIndexes; // ebx@8
  signed int bitIndex; // esi@8
  unsigned int v16; // eax@2
  void *v17; // esi@2
  unsigned int aCipherLength; // eax@6
  unsigned int aCipherLength2; // ebp@6
  int expectedResultSize; // ecx@6
  void *tempResultString; // eax@6
  unsigned int charAlphabetIndexShifted; // eax@9
  int v23; // eax@10
  int v24; // ecx@10
  unsigned int v25; // ebx@10
  void *Base64String; // [sp+14h] [bp-E8h]@1
  unsigned int v27; // [sp+ECh] [bp-10h]@1
  const char *aCipherText2; // [sp+34h] [bp-C8h]@1
  int v29; // [sp+30h] [bp-CCh]@1
  void *v30; // [sp+3Ch] [bp-C0h]@1
  int (__thiscall **v31)(void *, char); // [sp+38h] [bp-C4h]@1
  int v32; // [sp+F8h] [bp-4h]@1
  int expectedResultSize3; // [sp+28h] [bp-D4h]@6
  void *tempResultString2; // [sp+20h] [bp-DCh]@6
  int ciperLengthMinus5; // [sp+1Ch] [bp-E0h]@6
  int v36; // [sp+2Ch] [bp-D0h]@7
  int v37; // [sp+24h] [bp-D8h]@7
  int v38; // [sp+18h] [bp-E4h]@7

  v27 = (unsigned int)&Base64String ^ dword_1024FB2C;
  aCipherText = aText;
  v9 = a3;
  counter = 0;
  aCipherText2 = aText;
  v29 = a2;
  v30 = 0;
  v31 = &off_101B0F4C;
  v32 = 0;
  v6 = a4;
  sub_1011C310(a3, strlen(a3), a4);
  if ( a5 )
  {
    v16 = sub_1011CE20(v9, strlen(v9), &Base64String);
    v17 = Base64String;
    sub_1011C310(Base64String, v16, v6);
    j__free(v17);
  }
  if ( boolEncryptUSecurity )
    Base64String = USecurityAlphabet;
  else
    Base64String = Base64Alphabet;
  aCipherLength = strlen(aCipherText);
  aCipherLength2 = aCipherLength;
  expectedResultSize = ((unsigned __int64)(715827883i64 * (signed int)aCipherLength) >&gt; 32)
                     + ((unsigned int)((unsigned __int64)(715827883i64 * (signed int)aCipherLength) &gt;&gt; 32) &gt;&gt; 31);
  expectedResultSize2 = 4 * expectedResultSize + 1;
  expectedResultSize3 = 4 * expectedResultSize + 1;
  tempResultString = operator new(4 * expectedResultSize + 1);
  resultString = tempResultString;
  tempResultString2 = tempResultString;
  memset(tempResultString, 0, expectedResultSize2);
  *((_BYTE *)resultString + expectedResultSize2 - 1) = 0;
  ciperLengthMinus5 = aCipherLength2 - 5;
  if ( (signed int)(aCipherLength2 - 5) &gt; 0 )
  {
    intCounter = (int)(resultString + 2);
    v36 = resultString - ((char *)resultString - 1);
    v37 = resultString - ((char *)resultString - 1) - 2;
    v38 = resultString - ((char *)resultString - 1) - 3;
    do
    {
      charAlphabetIndexes = 0;
      bitIndex = 0;
      do
      {
        charAlphabetIndexShifted = (strchr((const char *)Base64String, aCipherText2[counter]) - Base64String) <&lt; bitIndex;
        bitIndex += 6;
        ++counter;
        charAlphabetIndexes += charAlphabetIndexShifted;
      }
      while ( bitIndex &lt; 36 );
      v23 = v37;
      v24 = v38;
      *(_BYTE *)(v36 + intCounter) = charAlphabetIndexes;
      v25 = charAlphabetIndexes >&gt; 8;
      *(_BYTE *)intCounter = v25;
      v25 &gt;&gt;= 8;
      *(_BYTE *)(v23 + intCounter) = v25;
      *(_BYTE *)(v24 + intCounter) = BYTE1(v25);
      intCounter += 4;
    }
    while ( counter &lt; ciperLengthMinus5 );
    resultString = tempResultString2;
    expectedResultSize2 = expectedResultSize3;
  }
  *(_BYTE *)(*(_DWORD *)v29 + sub_1011CDB0(resultString, expectedResultSize2, v29) - 1) = 0;
  j_j__free(resultString);
  v31 = &off_101B0F30;
  j_j__free(v30);
  return sub_10151C4E();

你可能感兴趣的:(算法,职场,休闲)