t('ROT13'), 'description' => t('A simple letter substitution cipher that replaces each letter with the letter 13 letters after it in the alphabet.'), 'encrypt callback' => 'encrypt_encryption_methods_rot13', 'settings form' => 'encrypt_ro13_method_settings_form', ); /** * Callback for Encrypt implementation: ROT13. * * This method uses the ROT13 method of character substitution. The key * is ignored. */ function encrypt_encryption_methods_rot13($op, $text, $key, $options = array()) { $processed_text = ''; // Caching length operations to speed up for loops. $text_length = strlen($text); // Loop through each character. for ($i = 0; $i < $text_length; $i++) { $char = substr($text, $i, 1); // Encrypt or decrypt the character. $char = str_rot13($char); $processed_text .= $char; } return $processed_text; } /** * Settings form for the ROT13 encryption method. */ function encrypt_ro13_method_settings_form($defaults) { $form = array(); $form['unused'] = array( '#type' => 'textfield', '#title' => t('Unused'), '#description' => t('This field is not used.'), '#default_value' => isset($defaults['unused']) ? $defaults['unused'] : '', '#required' => TRUE, ); return $form; }