Guest User

Untitled

a guest
Aug 20th, 2019
82
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. __int64 __fastcall ITF::StrToCRC_Template<1u>(unsigned __int8 *a1, unsigned int a2)
  2. {
  3. unsigned int v2; // w8
  4. int v3; // w10
  5. unsigned int v4; // w11
  6. int v5; // w9
  7. int v6; // w12
  8. int v7; // w13
  9. int v8; // w14
  10. unsigned int v9; // w12
  11. int v10; // w13
  12. int v11; // w15
  13. unsigned int v12; // w12
  14. int v13; // w14
  15. int v14; // w12
  16. int v15; // w13
  17. int v16; // w9
  18. int v17; // w12
  19. int v18; // w15
  20. unsigned int v19; // w14
  21. int v20; // w15
  22. unsigned int v21; // w14
  23. int v22; // w13
  24. int v23; // w14
  25. int v24; // w15
  26. int v25; // w8
  27. int v26; // w9
  28. unsigned int v27; // w12
  29. unsigned __int8 v28; // w13
  30. int v29; // w15
  31. unsigned int v30; // w12
  32. unsigned __int8 v31; // w13
  33. unsigned int v32; // w10
  34. int v33; // w9
  35. unsigned int v34; // w8
  36. unsigned int v35; // w10
  37. int v36; // w9
  38. unsigned int v37; // w8
  39. unsigned int v38; // w10
  40. unsigned int v39; // w10
  41. int v40; // w11
  42. int v41; // w11
  43. int v42; // w11
  44. int v43; // w11
  45. int v44; // w11
  46. int v45; // w11
  47. int v46; // w11
  48. int v47; // w11
  49. int v48; // w11
  50. int v49; // w11
  51. int v50; // w11
  52. int v51; // w9
  53. unsigned int v52; // w8
  54. unsigned int v53; // w10
  55. int v54; // w9
  56. unsigned int v55; // w8
  57. unsigned int v56; // w10
  58. int v57; // w9
  59.  
  60. v2 = -1640531527;
  61. v3 = 0;
  62. v4 = a2;
  63. v5 = -1640531527;
  64. if ( a2 >= 0xC )
  65. {
  66. do
  67. {
  68. v6 = *a1;
  69. v7 = a1[1];
  70. if ( (unsigned int)(v6 - 97) <= 0x19 )
  71. v6 += 224;
  72. v8 = a1[2];
  73. if ( (unsigned int)(v7 - 97) <= 0x19 )
  74. LOBYTE(v7) = v7 - 32;
  75. v9 = v6 & 0xFFFF00FF | ((unsigned __int8)v7 << 8);
  76. v10 = a1[3];
  77. if ( (unsigned int)(v8 - 97) <= 0x19 )
  78. LOBYTE(v8) = v8 - 32;
  79. if ( (unsigned int)(v10 - 97) <= 0x19 )
  80. LOBYTE(v10) = v10 - 32;
  81. v11 = a1[4];
  82. v12 = v9 & 0xFF00FFFF | ((unsigned __int8)v8 << 16);
  83. v13 = v11 + 224;
  84. v14 = v12 & 0xFFFFFF | ((unsigned __int8)v10 << 24);
  85. v15 = a1[6];
  86. v16 = v14 + v5;
  87. v17 = a1[8];
  88. if ( (unsigned int)(v11 - 97) > 0x19 )
  89. v13 = a1[4];
  90. v18 = a1[5];
  91. if ( (unsigned int)(v18 - 97) <= 0x19 )
  92. LOBYTE(v18) = v18 - 32;
  93. v19 = v13 & 0xFFFF00FF | ((unsigned __int8)v18 << 8);
  94. if ( (unsigned int)(v15 - 97) <= 0x19 )
  95. LOBYTE(v15) = v15 - 32;
  96. v20 = a1[7];
  97. v21 = v19 & 0xFF00FFFF | ((unsigned __int8)v15 << 16);
  98. if ( (unsigned int)(v20 - 97) <= 0x19 )
  99. LOBYTE(v20) = v20 - 32;
  100. if ( (unsigned int)(v17 - 97) <= 0x19 )
  101. v17 += 224;
  102. v22 = a1[9];
  103. v23 = v21 & 0xFFFFFF | ((unsigned __int8)v20 << 24);
  104. v24 = a1[10];
  105. v25 = v23 + v2;
  106. v26 = v16 - v25;
  107. if ( (unsigned int)(v22 - 97) <= 0x19 )
  108. LOBYTE(v22) = v22 - 32;
  109. v27 = v17 & 0xFFFF00FF | ((unsigned __int8)v22 << 8);
  110. v28 = v24 - 32;
  111. if ( (unsigned int)(v24 - 97) > 0x19 )
  112. v28 = a1[10];
  113. v29 = a1[11];
  114. a1 += 12;
  115. v30 = v27 & 0xFF00FFFF | (v28 << 16);
  116. if ( (unsigned int)(v29 - 97) <= 0x19 )
  117. v31 = v29 - 32;
  118. else
  119. v31 = v29;
  120. v32 = (v30 & 0xFFFFFF | (v31 << 24)) + v3;
  121. v33 = (v26 - v32) ^ (v32 >> 13);
  122. v34 = (v25 - v32 - v33) ^ (v33 << 8);
  123. v35 = (v32 - v33 - v34) ^ (v34 >> 13);
  124. v36 = (v33 - v34 - v35) ^ (v35 >> 12);
  125. v37 = (v34 - v35 - v36) ^ (v36 << 16);
  126. v38 = (v35 - v36 - v37) ^ (v37 >> 5);
  127. v5 = (v36 - v37 - v38) ^ (v38 >> 3);
  128. v2 = (v37 - v38 - v5) ^ (v5 << 10);
  129. v3 = (v38 - v5 - v2) ^ (v2 >> 15);
  130. v4 -= 12;
  131. }
  132. while ( v4 > 0xB );
  133. }
  134. v39 = v3 + a2;
  135. switch ( v4 )
  136. {
  137. case 1u:
  138. goto LABEL_59;
  139. case 2u:
  140. goto LABEL_56;
  141. case 3u:
  142. goto LABEL_53;
  143. case 4u:
  144. goto LABEL_50;
  145. case 5u:
  146. goto LABEL_47;
  147. case 6u:
  148. goto LABEL_44;
  149. case 7u:
  150. goto LABEL_41;
  151. case 8u:
  152. goto LABEL_38;
  153. case 9u:
  154. goto LABEL_35;
  155. case 0xAu:
  156. goto LABEL_32;
  157. case 0xBu:
  158. v40 = a1[10];
  159. if ( (unsigned int)(v40 - 97) <= 0x19 )
  160. v40 += 224;
  161. v39 += v40 << 24;
  162. LABEL_32:
  163. v41 = a1[9];
  164. if ( (unsigned int)(v41 - 97) <= 0x19 )
  165. LOBYTE(v41) = v41 - 32;
  166. v39 += (unsigned __int8)v41 << 16;
  167. LABEL_35:
  168. v42 = a1[8];
  169. if ( (unsigned int)(v42 - 97) <= 0x19 )
  170. LOBYTE(v42) = v42 - 32;
  171. v39 += (unsigned __int8)v42 << 8;
  172. LABEL_38:
  173. v43 = a1[7];
  174. if ( (unsigned int)(v43 - 97) <= 0x19 )
  175. v43 += 224;
  176. v2 += v43 << 24;
  177. LABEL_41:
  178. v44 = a1[6];
  179. if ( (unsigned int)(v44 - 97) <= 0x19 )
  180. LOBYTE(v44) = v44 - 32;
  181. v2 += (unsigned __int8)v44 << 16;
  182. LABEL_44:
  183. v45 = a1[5];
  184. if ( (unsigned int)(v45 - 97) <= 0x19 )
  185. LOBYTE(v45) = v45 - 32;
  186. v2 += (unsigned __int8)v45 << 8;
  187. LABEL_47:
  188. v46 = a1[4];
  189. if ( (unsigned int)(v46 - 97) <= 0x19 )
  190. LOBYTE(v46) = v46 - 32;
  191. v2 += (unsigned __int8)v46;
  192. LABEL_50:
  193. v47 = a1[3];
  194. if ( (unsigned int)(v47 - 97) <= 0x19 )
  195. v47 += 224;
  196. v5 += v47 << 24;
  197. LABEL_53:
  198. v48 = a1[2];
  199. if ( (unsigned int)(v48 - 97) <= 0x19 )
  200. LOBYTE(v48) = v48 - 32;
  201. v5 += (unsigned __int8)v48 << 16;
  202. LABEL_56:
  203. v49 = a1[1];
  204. if ( (unsigned int)(v49 - 97) <= 0x19 )
  205. LOBYTE(v49) = v49 - 32;
  206. v5 += (unsigned __int8)v49 << 8;
  207. LABEL_59:
  208. v50 = *a1;
  209. if ( (unsigned int)(v50 - 97) <= 0x19 )
  210. LOBYTE(v50) = v50 - 32;
  211. v5 += (unsigned __int8)v50;
  212. break;
  213. default:
  214. break;
  215. }
  216. v51 = (v5 - v2 - v39) ^ (v39 >> 13);
  217. v52 = (v2 - v39 - v51) ^ (v51 << 8);
  218. v53 = (v39 - v51 - v52) ^ (v52 >> 13);
  219. v54 = (v51 - v52 - v53) ^ (v53 >> 12);
  220. v55 = (v52 - v53 - v54) ^ (v54 << 16);
  221. v56 = (v53 - v54 - v55) ^ (v55 >> 5);
  222. v57 = (v54 - v55 - v56) ^ (v56 >> 3);
  223. return (v56 - v57 - ((v55 - v56 - v57) ^ (v57 << 10))) ^ (((v55 - v56 - v57) ^ (v57 << 10)) >> 15);
  224. }
  225.  
  226. from pytea import TEA
  227. key = os.urandom(16)
  228. print('key is', key)
  229. content = 'Hello, 你好'
  230. tea = TEA(key)
  231. e = tea.encrypt(content.encode())
  232. print('encrypt hex:', e.hex())
  233. d = tea.decrypt(e)
  234. print('decrypt:', d.decode())
RAW Paste Data