Reverse.php in AES encryption 8.2
File
src/Plugin/AES/Reverse.php
View source
<?php
namespace Drupal\aes\Plugin\AES;
use Drupal\aes\Plugin\AESPluginBase;
class Reverse extends AESPluginBase {
const SIGNATURE = 'Consider this an encrypted string: ';
public function __construct() {
parent::__construct([], 'aes-reverse', []);
}
public function encrypt($data, $key = FALSE, $cipher = FALSE) {
return self::SIGNATURE . strrev($data);
}
public function decrypt($data, $key = FALSE, $cipher = FALSE) {
if (strpos($data, self::SIGNATURE) !== 0) {
throw new \Exception("Sorry, this is not mine: " . $data);
}
return strrev(substr($data, strlen(self::SIGNATURE)));
}
}
Classes
Name |
Description |
Reverse |
Sample cryptor plugin. Does not really encrypt a string but just doing minor scrambling. |