Guest User

Untitled

a guest
Sep 7th, 2020
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.83 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * @ This file is created by http://DeZender.Net
  5. * @ deZender (PHP7 Decoder for ionCube Encoder)
  6. *
  7. * @ Version : 4.1.0.1
  8. * @ Author : DeZender
  9. * @ Release on : 29.08.2020
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. class Crypt_Base
  15. {
  16. /**
  17. * The Encryption Mode
  18. *
  19. * @see Crypt_Base::Crypt_Base()
  20. * @var Integer
  21. * @access private
  22. */
  23. public $mode;
  24. /**
  25. * The Block Length of the block cipher
  26. *
  27. * @var Integer
  28. * @access private
  29. */
  30. public $block_size = 16;
  31. /**
  32. * The Key
  33. *
  34. * @see Crypt_Base::setKey()
  35. * @var String
  36. * @access private
  37. */
  38. public $key = "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0";
  39. /**
  40. * The Initialization Vector
  41. *
  42. * @see Crypt_Base::setIV()
  43. * @var String
  44. * @access private
  45. */
  46. public $iv;
  47. /**
  48. * A "sliding" Initialization Vector
  49. *
  50. * @see Crypt_Base::enableContinuousBuffer()
  51. * @see Crypt_Base::_clearBuffers()
  52. * @var String
  53. * @access private
  54. */
  55. public $encryptIV;
  56. /**
  57. * A "sliding" Initialization Vector
  58. *
  59. * @see Crypt_Base::enableContinuousBuffer()
  60. * @see Crypt_Base::_clearBuffers()
  61. * @var String
  62. * @access private
  63. */
  64. public $decryptIV;
  65. /**
  66. * Continuous Buffer status
  67. *
  68. * @see Crypt_Base::enableContinuousBuffer()
  69. * @var Boolean
  70. * @access private
  71. */
  72. public $continuousBuffer = false;
  73. /**
  74. * Encryption buffer for CTR, OFB and CFB modes
  75. *
  76. * @see Crypt_Base::encrypt()
  77. * @see Crypt_Base::_clearBuffers()
  78. * @var Array
  79. * @access private
  80. */
  81. public $enbuffer;
  82. /**
  83. * Decryption buffer for CTR, OFB and CFB modes
  84. *
  85. * @see Crypt_Base::decrypt()
  86. * @see Crypt_Base::_clearBuffers()
  87. * @var Array
  88. * @access private
  89. */
  90. public $debuffer;
  91. /**
  92. * mcrypt resource for encryption
  93. *
  94. * The mcrypt resource can be recreated every time something needs to be created or it can be created just once.
  95. * Since mcrypt operates in continuous mode, by default, it'll need to be recreated when in non-continuous mode.
  96. *
  97. * @see Crypt_Base::encrypt()
  98. * @var Resource
  99. * @access private
  100. */
  101. public $enmcrypt;
  102. /**
  103. * mcrypt resource for decryption
  104. *
  105. * The mcrypt resource can be recreated every time something needs to be created or it can be created just once.
  106. * Since mcrypt operates in continuous mode, by default, it'll need to be recreated when in non-continuous mode.
  107. *
  108. * @see Crypt_Base::decrypt()
  109. * @var Resource
  110. * @access private
  111. */
  112. public $demcrypt;
  113. /**
  114. * Does the enmcrypt resource need to be (re)initialized?
  115. *
  116. * @see Crypt_Twofish::setKey()
  117. * @see Crypt_Twofish::setIV()
  118. * @var Boolean
  119. * @access private
  120. */
  121. public $enchanged = true;
  122. /**
  123. * Does the demcrypt resource need to be (re)initialized?
  124. *
  125. * @see Crypt_Twofish::setKey()
  126. * @see Crypt_Twofish::setIV()
  127. * @var Boolean
  128. * @access private
  129. */
  130. public $dechanged = true;
  131. /**
  132. * mcrypt resource for CFB mode
  133. *
  134. * mcrypt's CFB mode, in (and only in) buffered context,
  135. * is broken, so phpseclib implements the CFB mode by it self,
  136. * even when the mcrypt php extension is available.
  137. *
  138. * In order to do the CFB-mode work (fast) phpseclib
  139. * use a separate ECB-mode mcrypt resource.
  140. *
  141. * @link http://phpseclib.sourceforge.net/cfb-demo.phps
  142. * @see Crypt_Base::encrypt()
  143. * @see Crypt_Base::decrypt()
  144. * @see Crypt_Base::_setupMcrypt()
  145. * @var Resource
  146. * @access private
  147. */
  148. public $ecb;
  149. /**
  150. * Optimizing value while CFB-encrypting
  151. *
  152. * Only relevant if $continuousBuffer enabled
  153. * and $engine == CRYPT_MODE_MCRYPT
  154. *
  155. * It's faster to re-init $enmcrypt if
  156. * $buffer bytes > $cfb_init_len than
  157. * using the $ecb resource furthermore.
  158. *
  159. * This value depends of the choosen cipher
  160. * and the time it would be needed for it's
  161. * initialization [by mcrypt_generic_init()]
  162. * which, typically, depends on the complexity
  163. * on its internaly Key-expanding algorithm.
  164. *
  165. * @see Crypt_Base::encrypt()
  166. * @var Integer
  167. * @access private
  168. */
  169. public $cfb_init_len = 600;
  170. /**
  171. * Does internal cipher state need to be (re)initialized?
  172. *
  173. * @see setKey()
  174. * @see setIV()
  175. * @see disableContinuousBuffer()
  176. * @var Boolean
  177. * @access private
  178. */
  179. public $changed = true;
  180. /**
  181. * Padding status
  182. *
  183. * @see Crypt_Base::enablePadding()
  184. * @var Boolean
  185. * @access private
  186. */
  187. public $padding = true;
  188. /**
  189. * Is the mode one that is paddable?
  190. *
  191. * @see Crypt_Base::Crypt_Base()
  192. * @var Boolean
  193. * @access private
  194. */
  195. public $paddable = false;
  196. /**
  197. * Holds which crypt engine internaly should be use,
  198. * which will be determined automatically on __construct()
  199. *
  200. * Currently available $engines are:
  201. * - CRYPT_MODE_MCRYPT (fast, php-extension: mcrypt, extension_loaded('mcrypt') required)
  202. * - CRYPT_MODE_INTERNAL (slower, pure php-engine, no php-extension required)
  203. *
  204. * In the pipeline... maybe. But currently not available:
  205. * - CRYPT_MODE_OPENSSL (very fast, php-extension: openssl, extension_loaded('openssl') required)
  206. *
  207. * If possible, CRYPT_MODE_MCRYPT will be used for each cipher.
  208. * Otherwise CRYPT_MODE_INTERNAL
  209. *
  210. * @see Crypt_Base::encrypt()
  211. * @see Crypt_Base::decrypt()
  212. * @var Integer
  213. * @access private
  214. */
  215. public $engine;
  216. /**
  217. * The mcrypt specific name of the cipher
  218. *
  219. * Only used if $engine == CRYPT_MODE_MCRYPT
  220. *
  221. * @link http://www.php.net/mcrypt_module_open
  222. * @link http://www.php.net/mcrypt_list_algorithms
  223. * @see Crypt_Base::_setupMcrypt()
  224. * @var String
  225. * @access private
  226. */
  227. public $cipher_name_mcrypt;
  228. /**
  229. * The default password key_size used by setPassword()
  230. *
  231. * @see Crypt_Base::setPassword()
  232. * @var Integer
  233. * @access private
  234. */
  235. public $password_key_size = 32;
  236. /**
  237. * The default salt used by setPassword()
  238. *
  239. * @see Crypt_Base::setPassword()
  240. * @var String
  241. * @access private
  242. */
  243. public $password_default_salt = 'phpseclib/salt';
  244. /**
  245. * The namespace used by the cipher for its constants.
  246. *
  247. * ie: AES.php is using CRYPT_AES_MODE_* for its constants
  248. * so $const_namespace is AES
  249. *
  250. * DES.php is using CRYPT_DES_MODE_* for its constants
  251. * so $const_namespace is DES... and so on
  252. *
  253. * All CRYPT_<$const_namespace>_MODE_* are aliases of
  254. * the generic CRYPT_MODE_* constants, so both could be used
  255. * for each cipher.
  256. *
  257. * Example:
  258. * $aes = new Crypt_AES(CRYPT_AES_MODE_CFB); // $aes will operate in cfb mode
  259. * $aes = new Crypt_AES(CRYPT_MODE_CFB); // identical
  260. *
  261. * @see Crypt_Base::Crypt_Base()
  262. * @var String
  263. * @access private
  264. */
  265. public $const_namespace;
  266. /**
  267. * The name of the performance-optimized callback function
  268. *
  269. * Used by encrypt() / decrypt()
  270. * only if $engine == CRYPT_MODE_INTERNAL
  271. *
  272. * @see Crypt_Base::encrypt()
  273. * @see Crypt_Base::decrypt()
  274. * @see Crypt_Base::_setupInlineCrypt()
  275. * @see Crypt_Base::$use_inline_crypt
  276. * @var Callback
  277. * @access private
  278. */
  279. public $inline_crypt;
  280. /**
  281. * Holds whether performance-optimized $inline_crypt() can/should be used.
  282. *
  283. * @see Crypt_Base::encrypt()
  284. * @see Crypt_Base::decrypt()
  285. * @see Crypt_Base::inline_crypt
  286. * @var mixed
  287. * @access private
  288. */
  289. public $use_inline_crypt;
  290.  
  291. /**
  292. * Default Constructor.
  293. *
  294. * Determines whether or not the mcrypt extension should be used.
  295. *
  296. * $mode could be:
  297. *
  298. * - CRYPT_MODE_ECB
  299. *
  300. * - CRYPT_MODE_CBC
  301. *
  302. * - CRYPT_MODE_CTR
  303. *
  304. * - CRYPT_MODE_CFB
  305. *
  306. * - CRYPT_MODE_OFB
  307. *
  308. * (or the alias constants of the choosen cipher, for example for AES: CRYPT_AES_MODE_ECB or CRYPT_AES_MODE_CBC ...)
  309. *
  310. * If not explictly set, CRYPT_MODE_CBC will be used.
  311. *
  312. * @param optional Integer $mode
  313. * @access public
  314. */
  315. public function Crypt_Base($mode = CRYPT_MODE_CBC)
  316. {
  317. $const_crypt_mode = 'CRYPT_' . $this->const_namespace . '_MODE';
  318. ..................................................................
  319. ...................................
  320. ................
Add Comment
Please, Sign In to add comment