Source for file simplecrypt.php

Documentation is available at simplecrypt.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Legacy
  4.  * @subpackage  Simplecrypt
  5.  *
  6.  * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
  7.  * @license     GNU General Public License version 2 or later; see LICENSE
  8.  */
  9.  
  10. defined('JPATH_PLATFORM'or die;
  11.  
  12. /**
  13.  * JSimpleCrypt is a very simple encryption algorithm for encrypting/decrypting strings
  14.  *
  15.  * @package     Joomla.Legacy
  16.  * @subpackage  Simplecrypt
  17.  * @since       11.1
  18.  * @deprecated  12.3 (Platform) & 4.0 (CMS) - Use JCrypt instead.
  19.  */
  20. {
  21.     /**
  22.      * Encryption/Decryption Key
  23.      *
  24.      * @var         JCrypt 
  25.      * @since       12.1
  26.      * @deprecated  12.3  Use JCrypt instead.
  27.      */
  28.     private $_crypt;
  29.  
  30.     /**
  31.      * Object Constructor takes an optional key to be used for encryption/decryption. If no key is given then the
  32.      * secret word from the configuration object is used.
  33.      *
  34.      * @param   string  $privateKey  Optional encryption key
  35.      *
  36.      * @since       11.1
  37.      * @deprecated  12.3  Use JCrypt instead.
  38.      */
  39.     public function __construct($privateKey null)
  40.     {
  41.         JLog::add('JSimpleCrypt is deprecated. Use JCrypt instead.'JLog::WARNING'deprecated');
  42.  
  43.         if (empty($privateKey))
  44.         {
  45.             $privateKey md5(JFactory::getConfig()->get('secret'));
  46.         }
  47.  
  48.         // Build the JCryptKey object.
  49.         $key new JCryptKey('simple'$privateKey$privateKey);
  50.  
  51.         // Setup the JCrypt object.
  52.         $this->_crypt new JCrypt(new JCryptCipherSimple$key);
  53.     }
  54.  
  55.     /**
  56.      * Decrypt a string
  57.      *
  58.      * @param   string  $s  String to decrypt
  59.      *
  60.      * @return  string 
  61.      *
  62.      * @since   11.1
  63.      * @deprecated  12.3  Use JCrypt instead.
  64.      */
  65.     public function decrypt($s)
  66.     {
  67.         return $this->_crypt->decrypt($s);
  68.     }
  69.  
  70.     /**
  71.      * Encrypt a string
  72.      *
  73.      * @param   string  $s  String to encrypt
  74.      *
  75.      * @return  string 
  76.      *
  77.      * @since   11.1
  78.      * @deprecated  12.3  Use JCrypt instead.
  79.      */
  80.     public function encrypt($s)
  81.     {
  82.         return $this->_crypt->encrypt($s);
  83.     }
  84. }

Documentation generated on Tue, 19 Nov 2013 15:13:00 +0100 by phpDocumentor 1.4.3