\StringDecryptor
Class designed to deal with decrypting strings sent to it, either using XOR or AES encryption.
To use this class you create it, then set the encryption type and then call
decrypt().
Id the string was base64 encoded, you also need to call decode().
EG:
Using simple XOR encryption:
$encrypt = StringEncryptor::create('encrypt this')
->setHash('hashcode')
->decrypt()
->get();
XOR encryption then base 64 encoded:
$encrypt = StringEncryptor::create('encrypt this')
->setHash('hashcode')
->decode()
->decrypt()
->get();
MCrypt AES encryption
$encrypt = StringEncryptor::create('encrypt this')
->setHash('hashcode')
->setEncryption('MCRYPT')
->decrypt()
->get();
Synopsis
class StringDecryptor
{
- // members
- private String $data;
- private String $decrypted_data;
- private String $encryption = 'XOR';
- private String $hash;
- // methods
- private void __construct()
- public static StringEncryptor create()
- public StringDecryptor setEncryption()
- public StringDecryptor setHash()
- public String get()
- public StringDecryptor decode()
- public StringDecryptor decrypt()
- private void simplexor()
- private string mcrypt()
- private string removePKCS5Padding()
Members
private
Methods
private
- __construct()
- mcrypt() — Encrypt our data using PHP mcrypt and AES with PKCS5 padding
- removePKCS5Padding() — PHP's mcrypt does not have built in PKCS5 Padding, so we use this
- simplexor() — SimpleXor encryption algorithm