Last updated 14 June 2016. Created on 14 June 2016.
Edited by Novitsh. Log in to edit this page.

The Scrambler module helps you prevent exposing sensitive information from the database.

Please note that you should never use/enable Scrambler in a production environment!.
In case of accidental execution of the scrambling procedure there is no way back. Your data will then be damaged.

The Scrambler module is an API that helps you to prevent exposing sensitive
information from the database. It also contains the Scrambler Field submodule
which makes it able to administer which scramble methods to apply per field.

For a full description of the module, visit the project page.

Creating custom implementations

/**
 * Implements hook_scrambler_api().
 */
function scrambler_example_scrambler_api() {
  // Define your module name.
  $params['scrambler_example'] = array(
    // Give a unique machine name for your scrambling group.
    'shuffle_words_for_title' => array(
      // Define base table where these fields are located.
      'base_table' => 'scrambler_example',
      // Define the id of the base table.
      'id' => 'sid',
      // Define field names.
      'fields' => array('title'),
      // Define a scramble method from the scrambler API.
      'method' => SCRAMBLER_METHOD_SHUFFLE_WORDS,
    ),
    // Give a unique machine name for your scrambling group.
    'custom_method_for_teaser' => array(
      // Define base table where these fields are located.
      'base_table' => 'scrambler_example',
      // Define the id of the base table.
      'id' => 'sid',
      // Define field names.
      'fields' => array('teaser'),
      // Define your custom scrambling method.
      'method' => 'custom_scrambling',
    ),
  );

  return $params;
}

/**
 * Implements hook_scrambler_methods().
 */
function scrambler_example_scrambler_methods() {
  return array('custom_scrambling' => 'Custom scrambling (scrambler_example module)');
}

/**
 * Custom scrambling method by the scrambler_example module.
 *
 * @param string $data
 *   Input data to scramble.
 *
 * @return string
 *   Returns the scrambled string.
 */
function _scrambler_example_method_custom_scrambling(&$data) {
  // Manipulate the $data parameter in which way you think is necessary.
  return str_replace('e', 'x', str_replace('a', 'y', $data));
}

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.