You are here

class Drupal_Crypt_Blowfish in Web Service Clients 7

Same name and namespace in other branches
  1. 6.2 connections/clients_drupal/crypt_blowfish/crypt_blowfish.inc \Drupal_Crypt_Blowfish
  2. 6 backends/clients_drupal/crypt_blowfish/crypt_blowfish.inc \Drupal_Crypt_Blowfish
  3. 7.3 connections/clients_drupal/crypt_blowfish/crypt_blowfish.inc \Drupal_Crypt_Blowfish
  4. 7.2 connections/clients_drupal/crypt_blowfish/crypt_blowfish.inc \Drupal_Crypt_Blowfish

Hierarchy

Expanded class hierarchy of Drupal_Crypt_Blowfish

File

backends/clients_drupal/crypt_blowfish/crypt_blowfish.inc, line 12
Wrapper for PEAR Crypt Blowfish

View source
class Drupal_Crypt_Blowfish {

  /**
   *
   */
  public static function decrypt($encrypted) {
    $bf = self::blowfish();
    return trim($bf
      ->decrypt($encrypted));

    // that was fun to debug
  }

  /**
   *
   */
  public static function encrypt($plaintext) {
    $bf = self::blowfish();
    return $bf
      ->encrypt($plaintext);
  }

  /**
   *
   */
  protected static function blowfish() {
    ini_set('include_path', ini_get('include_path') . ':' . variable_get('crypt_blowfish_cryptdir', ''));
    include_once 'Crypt/Blowfish.php';
    return new Crypt_Blowfish(self::getkey());
  }

  /**
   *
   */
  public static function getkey() {
    $filename = drupal_get_path('module', 'crypt_blowfish') . '/crypt_blowfish_key.inc';
    $handle = fopen($filename, "r");
    $key = fread($handle, filesize($filename));
    fclose($handle);
    return $key;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Drupal_Crypt_Blowfish::blowfish protected static function
Drupal_Crypt_Blowfish::decrypt public static function
Drupal_Crypt_Blowfish::encrypt public static function
Drupal_Crypt_Blowfish::getkey public static function